Newbie trying to bind to dataset

M

MattB

Hello group. I'm new here and to .net (you guys probably never hear that,
right?). I have some development background, so I'm hoping to get up to
speed quickly.

I'm trying to write an ASP.net app using web forms and vb.net that queries a
c++ dll and displays the return nicely. My dll returns a string that is an
ado recordset. I figured this should be easy to parse and bind to a
datagrid, but I keep striking out.

Here's an example of the return string:

OK :<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:CommandTimeout='30'>
<s:AttributeType name='guest_no' rs:number='1' rs:writeunknown='true'>
<s:datatype dt:type='number' rs:dbtype='numeric' dt:maxLength='19'
rs:scale='0' rs:precision='17' rs:fixedlength='true'
rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='first_name' rs:number='2' rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='15'
rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='last_name' rs:number='3' rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='20'
rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='birth_date' rs:number='4' rs:nullable='true'
rs:writeunknown='true'>
<s:datatype dt:type='dateTime' rs:dbtype='timestamp'
dt:maxLength='16' rs:scale='3' rs:precision='23' rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='phone' rs:number='5' rs:nullable='true'
rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='8'
rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='address' rs:number='6' rs:nullable='true'
rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='30'/>
</s:AttributeType>
<s:AttributeType name='city' rs:number='7' rs:nullable='true'
rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='25'/>
</s:AttributeType>
<s:AttributeType name='state' rs:number='8' rs:nullable='true'
rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='2'
rs:fixedlength='true'/>
</s:AttributeType>
<s:AttributeType name='zip' rs:number='9' rs:nullable='true'
rs:writeunknown='true'>
<s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='10'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row guest_no='16099000' first_name='MATT '
last_name='MESSINGER '/>
</rs:data>
</xml>

I think I'm ok with the 'OK :' at the begining because that would be ignored
when the parsing takes place.
It also looks like the way to go would be DataSet.ReadXML, but I can't get
it to work. In my code behind I have the following in Page_Load:

Dim myDataSet As New DataSet
Dim ox As Object, x As String
ox = CreateObject("ww.main")
x =
ox.invoke("<func>lookupguests</func><first_name>matt</first_name><last_name>
messinger</last_name>")
TEXTAREA1.Value() = x
ox = Nothing
myDataSet.ReadXml(x)

I get my dll output in the text box - so I know it works to populate x, but
doesn't like the myDataSet.ReadXml(x) part. (error is The path is too long
after being fully qualified. - so it's looking for a file instead of a
string)
Can anyone give me an example of how I would need to get this to work, and
how I could then bind that dataset to a grid? Thanks!
 
E

Eric Veltman

Hello MattB,
myDataSet.ReadXml(x)

I get my dll output in the text box - so I know it works to populate x,
but doesn't like the myDataSet.ReadXml(x) part. (error is The path is too
long after being fully qualified. - so it's looking for a file instead of
a string)

The myDataSet.ReadXml method also has an overload that accepts an argument
derived from TextReader. Pass it a StringReader that wraps around the string
containing the XML you want to load and you're all set.

Best regards,

Eric
 
M

MattB

Eric said:
Hello MattB,


The myDataSet.ReadXml method also has an overload that accepts an
argument derived from TextReader. Pass it a StringReader that wraps
around the string containing the XML you want to load and you're all
set.

Best regards,

Eric

Thanks for the response. Any way you could post a sample? Looking in the
help files just doesn't seem clear to me.

Matt
 
E

Eric Veltman

Hello Matt,
Thanks for the response. Any way you could post a sample? Looking in the
help files just doesn't seem clear to me.

I've never used this stuff myself, and don't have dotnet on my Linux PC
at home, but from what I've read from the docs, I think this is how to
load the XML from string :

myDataSet.ReadXml(New StringReader(x))

If it doesn't work, take a look at the class doco at
http://tinyurl.com/1qzi

Regards,

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top