Getting only the first paragraph of data from sql server 2005 in vb.net 2.0

Hi all,

I have a table in sql server which consists of two colums. column 1 contain "id" integer and column 2 contain "body" varchar(max). For example:

id - 1

body -

French Industrial production sharply decreased 1.5% month-on-month in November, reversing from a 2.1% increase seen in October, the statistical office Insee said in a report Thursday. Economists were looking for a 0.6% fall. Production in the automotive industry fell steeply 5.3% versus 7.5% rise in October, while energy output declined 2% from 2.1% recorded in the previous month. In the construction sector, production was down 0.4%. Agricultural and food industries also posted 2% decrease. 

Compared to the previous year, the overall industrial output from industries grew 2.7%.

Now in vb.net 2.0 grid view i have to get only the first paragraph of body..how can i get it? that is :

French Industrial production sharply decreased 1.5% month-on-month in November, reversing from a 2.1% increase seen in October, the statistical office Insee said in a report Thursday. Economists were looking for a 0.6% fall. Please send me the code to do the above.. 

 


Thanks
Swapna
Please click "mark as answer" if this post helped you.
0
swapnasamsonvarkey
1/21/2008 12:11:33 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

10 Replies
982 Views

Similar Articles

[PageSpeed] 38

You could modify the SQL to return a new column containing the position of the first line feed:  

SELECT     ID, Body,  CHARINDEX(CHAR(13), Body) AS FirstParagraphLen
FROM        MyTable
 
Steve Wellens

My blog
0
SGWellens
1/21/2008 3:34:32 PM

Hi steve,

Thanks for the reply.I have modified what i want really .. please read it again and please reply ...

Thanks again..

 


Thanks
Swapna
Please click "mark as answer" if this post helped you.
0
swapnasamsonvarkey
1/22/2008 3:19:51 AM

Pls some one answer my question.It is urgent.. My question is how i've to display only the first paragraph of the body in the grid view. please please send me the code..


Thanks
Swapna
Please click "mark as answer" if this post helped you.
0
swapnasamsonvarkey
1/22/2008 3:53:34 AM

 Hi,

you can use the below query...

SELECT     ID,  SUBSTRING(FirstName, 1, CHARINDEX(CHAR(13), Body)) AS 'Text'
FROM TableName

 


Vasanthakumar
Software Engineer.
0
vasanth
1/22/2008 5:07:19 AM

what is "FirstName" ?

 


Thanks
Swapna
Please click "mark as answer" if this post helped you.
0
swapnasamsonvarkey
1/22/2008 5:17:30 AM

 Hi,

its not firstname it must be body...

SELECT     ID,  SUBSTRING(Body, 1, CHARINDEX(CHAR(13), Body)) AS 'Text'
FROM TableName

 


Vasanthakumar
Software Engineer.
0
vasanth
1/22/2008 5:21:20 AM

May be its the column name.It must be replaced.Plz check out

Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you. 


Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you.
0
srijaya_ramaraju
1/22/2008 5:29:03 AM

Hi ,

It is displaying only the records which that are long. it is not displaying short records.. What i meant is that: Consider in my table i have two records as follows:

id : 1

body:

Kolkata (PTI): West Bengal Governor Gopalkrishna Gandhi on Monday met CPI(M) patriarch Jyoti Basu to seek his initiative to restore peace.  

"I am sure that his initiatives will bring back peace in Nandigram," the Governor told reporters after a 40-minute meeting with the former chief minister at his Salt Lake residence.”

id - 2

body: 19 officers, jawans get Sena, Vishist Seva medals

Now when i add the command "

select id,substring(body,1,CHARINDEX(CHAR(13),body)) As 'text' from Article

my grid view is only displaying the first paragraph of 2nd record. the first record is a blank one.

I want my grid view to display as follows:

id         text

1        Kolkata (PTI): West Bengal Governor Gopalkrishna Gandhi on Monday met CPI(M) patriarch Jyoti Basu to seek his initiative

          to restore peace.

2       19 officers, jawans get Sena, Vishist Seva medals

please send me the code to display like this.thanks for all of ur helps.


Thanks
Swapna
Please click "mark as answer" if this post helped you.
0
swapnasamsonvarkey
1/23/2008 4:00:06 AM

Hi swapnasamsonvarkey,

I have an idea that you can insert a char(13) into the end of body field text, you can run the following SQL
statement in SQL Server 2005 to fulfill this function.

UPDATE    Article
SET              Body = CAST(Body AS varchar(MAX)) + CHAR(13);

Note: make sure every Body text has a char(13) end when you want to insert a new record.

Regards,
Xun

 


Regards,
Xun Ye.
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that
helps you, and to click “Unmark as Answer” if a marked post
does not actually answer your question. This can be beneficial
to other community members reading the thread.
0
Xun
1/23/2008 7:23:24 AM

well what  I suggest is that you find the first occurance of  '</p>' and then get the data upto that index.

I don't know the exact SQL statement, but I know this could be done in this way.


Umair Hafeez Mughal
Asst. Software Engineer
Virtual University of Pakistan

------------------------------

Please remember to click “Mark as Answer” on the post that helps you.
0
umairmoghal
1/23/2008 7:35:31 AM
Reply:

Similar Artilces:

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

how to get values from first two paragraphs in vb.net 2.0
hi all , i'm using vb.net 2.0. i want to get values from a textbox1's first or second para's . That is if the first para is less that 200 i want to get second para and show the first two para's in the textbox2 other display only the first para's in textbox2.  Please tell me how to get these..Thanks SwapnaPlease click "mark as answer" if this post helped you. Please be a little more clear, the text is confusing. sounds like the string needs to be searched for a number of spaces for a location to be split by and then sent to text boxes  D...

.NET 2.0 Data Connection (.NET 2.0 Beta Data Provider)
I have installed the .NET 2.0 Beta Data Provider, in the server explorer in Visual Studio 2005 I have tried to connect to this provider but I can not see it in the list. Is there something else you need to do to see this other than what is in the instructions or is this not supported yet? Hi Dean, I assume you mean ASE ADO.NET 2.0 Beta. I'm attaching the html readme for this product that you should have from downloading it. Are you talking about using Server Explorer to see the Provider? This functionality isn't working yet and should be available on GA or shortly ...

How to get new web app to use .NET 2.0 on Win2K server using .NET 1.1 as default framework?
I have .net framework1.1 and 2.0 on our server running win2K. i have existing applications that uses asp.net 1.1, i also have a new app that use ASP.net 2.0.  how can i set my new .NET 2.0 app to point to asp.net 2.0 without messing up my existing .NET 1.1 apps? To specify the ASP .Net version fro a web application, do the followingIn IIS Manager select the web application -> Properties -> ASP.Net TabSelect  ASP.Net version you want to use for the applicationRegards,PrashantDont forget to click "Mark as Answer" on the post that helped you. But I am running Win2K...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0 #2
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! There are too many differences for one email - - from 1.0 to 1.1 (not a whole lot of real change, other than fixes, at least compared to 1.1 to 2.0) With 2.0, there were many new declarative controls, with many new ideas added in With 3.0, it's a superset of 2.0 - instead of replacing the installation completely, it just 'added on' new functionality - I would...

Access .Net 2.0 Application from .Net 2.0 Web Site
I need to populate a specific form in a .Net desktop application from a .net web application.  Is there an easy way to go about this? Hi, Based on my understanding, you want to start an executable application from your ASP.NET websit, right? We can invoke Process.Start method (http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx) to launch an executable application from ASP.NET application. Note: Please keep in mind, the ASP.NET application is running on the server, so it will start the executable application that exists in the server.   I look...

DW.Net 2.0, TreeView expansion in VB.Net 2005
Hello, I created a TreeView datawindow in DW.Net 2.0 Designer. It contains 3 expansion levels. The inner level expands correctly in the designer, displaying multiple lines as appropriate. In Visual Studio 2005, under VB.Net, all levels look correct, except that the innermost level will not display more than one line. Anyone have an idea what is needed under VB.Net to permit all detail lines to display? Thanks for your help. Joel H. Replying to my own message: This problem appears to have been caused by incorrect filters. An extra filter was created in a l...

web.config problems when upgrading from .NET 2.0 Beta to .NET 2.0 release version
We uninstalled .NET 2.0 Beta and replaced it with .NET 2.0 release version.  And it messed everything up.  All applications now give weird errors indicating the lack of web.config files, despite the fact that they already have web.config files in place.  For example, the following error occurs even though the web.config file has <customErrors="Off">: Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for securit...

Sql Server 2005 & net 2.0
Hi all, I am preparing to plan some new sites to be built on .net 2.0 and was wondering about Sql Server 2005.  Is this a requirment in the upgrade to go to  2.0.  I hear that its not required but it's highly recommended. What are your thoughts on it?   thanks mcm...

Post form with data to a external site (.net 1.1 vb.net) #2
Hi There I am programming a e-shop (.net 1.1) and what I want to achive is: Customer fill out form, clicks on the Pay button then should the following thing happen: Problem is that I need to do a "Clean post" like if the user would have pressed the submit buttom on a normal HTML page I don't need the result in the ASP application, the external site will take over from there. The syntax are ASP.net local application : form data is save in a local db ASP.net local application : A POST string is created ( I could create a FORM in real html but then the use has to press twice) The ...

MS SQL SERVER 2005 and Datawindow.NET 2.0
Hi all, I test datawindow.net 2.0 (4621) and sql server 2005 , When I use Datetime field and chnage value , datawindow can't not update value to database. TIA How are you connecting to the database? ADO .NET, OLE DB, or ODBC? Regards, Dave Fish Sybase On 22 Jun 2006 18:25:11 -0700, "Robert" <jooong@empal.com> wrote: >Hi all, > >I test datawindow.net 2.0 (4621) and sql server 2005 , >When I use Datetime field and chnage value , datawindow >can't not update value to database. > >TIA > > There are changes r...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! Have a look into this links http://en.wikipedia.org/wiki/.NET_Framework http://blogs.msdn.com/mohammadakif/archive/2006/12/03/net-3-0-different-versions-of-the-net-framework.aspx http://www.codeproject.com/aspnet/ComparisonASP1xASP20.aspAshok Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that m...

Getting data form SQL Server 2005 to a Web.SiteMap file
I want read a hierarchal data table in SQL Server 2005 to write My Web.SiteMap file. How I to do it? web.sitemap is a static file used by the XmlSiteMapProvider if you know your site navigation at development time. If you have a data-driven navigation, then you should consider creating your own SiteMapProvider. -Brock  DevelopMentorhttp://staff.develop.com/ballen...

Web resources about - Getting only the first paragraph of data from sql server 2005 in vb.net 2.0 - asp.net.web-forms

Paragraph 175 (film) - Wikipedia, the free encyclopedia
Paragraph 175 is a documentary film released in 2000, directed by Rob Epstein and Jeffrey Friedman , and narrated by Rupert Everett . The film ...

Paragraph Shorts for iPad on the iTunes App Store
Get Paragraph Shorts on the App Store. See screenshots and ratings, and read customer reviews.

Brazil’s ANJ boycotts Google News, wants compensation for headlines and lede paragraphs
... happy with Google News, as it recently opted out of the free news aggregator, over complaints that Google crops news headlines and lede paragraphs ...

Quartz Lets Readers Comment on Specific Paragraphs
... business publication on Tuesday introduced a new feature that lets readers weigh in on—and publish comments right next to—individual paragraphs ...

Read the $4 Billion Paragraph That Oracle and HP Are Fighting Over
... filed after Oracle hired former HP CEO Mark Hurd as co-president. In that settlement agreement — which ended HP’s suit over Hurd — is a paragraph ...

Hey, Fareed, You've Got a Paragraph; You Didn't Write That
He really didn't. In penning his recent piece "The Case for Gun Control," Time editor and CNN host Fareed Zakaria actually made the case that ...

The Mother Of All “To-Be-Sure” Paragraphs
Jeff Rosen has a very persuasive – and very damning – analysis of the Obama administration’s legal defenses of its NSA spying. They make Bill ...

Alter helps you stay productive by picking to-dos out of paragraphs
Alter OmniFocus 2 for iPhone Clear Tasks, Reminders & To-Do Lists Alter helps you stay productive by picking to-dos out of paragraphs is a ...

Maybe the Most Perfect Wingnut Paragraph Ever
Joe Kovacs at Wingnut Daily : Medical examiners in Los Angeles are investigating the possible poisoning death of one of their own officials ...

How one paragraph, deep in the state budget, could change the face of Maine’s capital
Posted April 25, 2015, at 9:42 a.m. On the east bank of the Kennebec River in downtown Augusta are the grounds of the former Augusta Mental Health ...

Resources last updated: 12/5/2015 9:21:06 PM