Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can we populate a XML formated string into a dataset?

Reply
Thread Tools

Can we populate a XML formated string into a dataset?

 
 
=?Utf-8?B?ZGF2aWQ=?=
Guest
Posts: n/a
 
      03-29-2007
When I check the syntax of dataset, It seems that dataset can only read data
from file. (e.g., datset.read(string filename), dataset.readxml(string
filename)).

If I have a string with XML format that is transfered from somewhere else,
how can I read the string and populate it into a dataset, then display the
data in a data grid?

Thanks for any help.

David
 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      03-29-2007
http://www.google.com/search?hl=en&q...+to+dataset%22

There's good info in the links returned by that Google query.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"david" <> wrote in message
news:A266F9C2-A7AF-4DE4-A3C0-...
> When I check the syntax of dataset, It seems that dataset can only read data
> from file. (e.g., datset.read(string filename), dataset.readxml(string
> filename)).
>
> If I have a string with XML format that is transfered from somewhere else,
> how can I read the string and populate it into a dataset, then display the
> data in a data grid?
>
> Thanks for any help.
>
> David



 
Reply With Quote
 
 
 
 
=?Utf-8?B?ZGF2aWQ=?=
Guest
Posts: n/a
 
      03-29-2007
I have searched Yahoo and Microsoft web, some info seems useful but doesn't
work.

I will try to find some.

David

"Juan T. Llibre" wrote:

> http://www.google.com/search?hl=en&q...+to+dataset%22
>
> There's good info in the links returned by that Google query.
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en español : http://asp.net.do/foros/
> ===================================
> "david" <> wrote in message
> news:A266F9C2-A7AF-4DE4-A3C0-...
> > When I check the syntax of dataset, It seems that dataset can only read data
> > from file. (e.g., datset.read(string filename), dataset.readxml(string
> > filename)).
> >
> > If I have a string with XML format that is transfered from somewhere else,
> > how can I read the string and populate it into a dataset, then display the
> > data in a data grid?
> >
> > Thanks for any help.
> >
> > David

>
>
>

 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      03-29-2007
Here's a quick example :

<%@ Import Namespace="System.Data" %>
<script runat="server">
sub Page_Load(sender as Object, e as EventArgs)
Dim myDataSet as New DataSet()

myDataSet.ReadXml(Server.MapPath("some.xml"))

dgSome.DataSource = myDataSet
dgSome.DataBind()
end sub
</script>

<body>
<asp:datagrid id="dgSome" runat="server" />
</body>

If you are getting the XML from a stream,
you'll need to write it to disk before using this method.

That shouldn't present too many complications.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"david" <> wrote in message
news:81C2B9F2-007A-4295-9935-...
>I have searched Yahoo and Microsoft web, some info seems useful but doesn't
> work.
>
> I will try to find some.
>
> David


> "Juan T. Llibre" wrote:
>
>> http://www.google.com/search?hl=en&q...+to+dataset%22
>>
>> There's good info in the links returned by that Google query.
>>
>>
>>
>> Juan T. Llibre, asp.net MVP
>> asp.net faq : http://asp.net.do/faq/
>> foros de asp.net, en español : http://asp.net.do/foros/
>> ===================================
>> "david" <> wrote in message
>> news:A266F9C2-A7AF-4DE4-A3C0-...
>> > When I check the syntax of dataset, It seems that dataset can only read data
>> > from file. (e.g., dataset.read(string filename), dataset.readxml(string filename)).


>> > If I have a string with XML format that is transfered from somewhere else,
>> > how can I read the string and populate it into a dataset, then display the
>> > data in a data grid?
>> >
>> > Thanks for any help.
>> >
>> > David



 
Reply With Quote
 
=?Utf-8?B?UGFydmF0aHkgUGFkbWFuYWJoYW4=?=
Guest
Posts: n/a
 
      03-29-2007
Incase you have yr xml in the form of a string and not a physical .xml file
on the server, in that case you could try this option.

Load the string into an StringReader object and the same can be passed to
the ReadXml method of the dataset.

StringReader strReader = new StringReader(str);
DataSet _ds = new DataSet();
_ds.ReadXml(strReader);
Response.Write(_ds.GetXml());

This should work.
 
Reply With Quote
 
=?Utf-8?B?ZGF2aWQ=?=
Guest
Posts: n/a
 
      03-30-2007
Thanks
I will try your stringreader.

David

"Parvathy Padmanabhan" wrote:

> Incase you have yr xml in the form of a string and not a physical .xml file
> on the server, in that case you could try this option.
>
> Load the string into an StringReader object and the same can be passed to
> the ReadXml method of the dataset.
>
> StringReader strReader = new StringReader(str);
> DataSet _ds = new DataSet();
> _ds.ReadXml(strReader);
> Response.Write(_ds.GetXml());
>
> This should work.

 
Reply With Quote
 
=?Utf-8?B?ZGF2aWQ=?=
Guest
Posts: n/a
 
      03-30-2007
Thanks for all of you.

StringReader makes the program work.

David

"Parvathy Padmanabhan" wrote:

> Incase you have yr xml in the form of a string and not a physical .xml file
> on the server, in that case you could try this option.
>
> Load the string into an StringReader object and the same can be passed to
> the ReadXml method of the dataset.
>
> StringReader strReader = new StringReader(str);
> DataSet _ds = new DataSet();
> _ds.ReadXml(strReader);
> Response.Write(_ds.GetXml());
>
> This should work.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 UNIX formated text files to DOS formated? walterbyrd Python 13 05-13-2009 02:32 PM
Convert currency formated string back into decimal =?Utf-8?B?R3JlZyBH?= ASP .Net 1 11-03-2007 04:48 PM
Treeview.TreeNodeSrc = "xml formated string" does url-request ThoGen ASP .Net Web Controls 0 04-21-2006 09:14 AM
Populate a popup window with clickable records from an Access DB and upon clicking, populate a selectbox on the original webpage with the clicked record Enjoy Life ASP General 2 02-23-2005 10:48 PM
mixing raw xml display w/ formated display blank101 XML 2 02-05-2005 03:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57