PC Review


Reply
Thread Tools Rate Thread

convert string to datatable

 
 
Hemant
Guest
Posts: n/a
 
      14th Oct 2009
Hi,

I have a string it contain following string .

<taSopLineIvcInsert><SOPTYPE>2</SOPTYPE><SOPNUMBE>123456
</SOPNUMBE><CUSTNMBR>345</CUSTNMBR><DOCDATE>10/10/2009</DOCDATE><ITEMNMBR>2342</ITEMNMBR><UNITPRCE>5.20</UNITPRCE><XTNDPRCE>10.40</XTNDPRCE><QUANTITY>2.000</QUANTITY><ITEMDESC>Story
Book</ITEMDESC><TAXAMNT>0.81</TAXAMNT><LNITMSEQ>2343</LNITMSEQ></taSopLineIvcInsert>

i want to select this string and want to show this in csv file . for this i
and doing string manuplation and find this substring and than add this to a
xml file and that converting this xml file to table and than showing the
data in csv file.

Is there another easy method?

Thanks,

Hemant


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      14th Oct 2009
On Oct 14, 9:02*am, "Hemant" <Hem...@nomail.com> wrote:
> Hi,
>
> I have a string it contain following string .
>
> <taSopLineIvcInsert><SOPTYPE>2</SOPTYPE><SOPNUMBE>123456
> </SOPNUMBE><CUSTNMBR>345</CUSTNMBR><DOCDATE>10/10/2009</DOCDATE><ITEMNMBR>2*342</ITEMNMBR><UNITPRCE>5.20</UNITPRCE><XTNDPRCE>10.40</XTNDPRCE><QUANTITY>*2.000</QUANTITY><ITEMDESC>Story
> Book</ITEMDESC><TAXAMNT>0.81</TAXAMNT><LNITMSEQ>2343</LNITMSEQ></taSopLineI*vcInsert>
>
> i want to select this string and want to show this in csv file . for thisi
> and doing string manuplation and find this substring and than add this toa
> xml file and that converting this xml file to table and than showing the
> data in csv file.
>
> Is there another easy method?
>
> Thanks,
>
> Hemant


I think you can also do it making a loop through the document

Something like this

XmlNode p = xmlDoc.SelectSingleNode("//taSopLineIvcInsert");
foreach (XmlNode n in p)
{
Response.Write(n.Name + "/t" + n.InnerText + "/n");
}

if you add

Response.Clear();
Response.AddHeader("content-disposition",
"attachment;filename=doc.csv");
Response.ContentType = "application/vnd.ms-excel";

you should get an xml

Hope this helps
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert 'System.Collections.ObjectModel.ReadOnlyCollection(Of String)' to '1-dimensional array of String'. roidy Microsoft VB .NET 12 17th Jul 2009 10:53 AM
Convert DataTable to Xml string variable... Matthew Wells Microsoft C# .NET 7 7th May 2008 06:13 AM
Convert DataTable to Xml string variable... Matthew Wells Microsoft ASP .NET 2 24th Feb 2008 03:11 AM
Convert a latebinded DataTable column's format from DateTime to string (or format the date time value) RSH Microsoft VB .NET 0 6th Dec 2006 03:49 PM
Convert a DataTable to a Strongly Typed DataTable. Anibal Microsoft ADO .NET 4 22nd Jan 2005 05:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 AM.