Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Newbie trying to bind to dataset

Reply
Thread Tools

Newbie trying to bind to dataset

 
 
MattB
Guest
Posts: n/a
 
      12-22-2003
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' rsrecision='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' rsrecision='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!
--

Matt

"Gravity. It's not just a good idea, it's the law!"


 
Reply With Quote
 
 
 
 
Eric Veltman
Guest
Posts: n/a
 
      12-22-2003
Hello MattB,

MattB wrote:

> 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
 
Reply With Quote
 
 
 
 
MattB
Guest
Posts: n/a
 
      12-22-2003
Eric Veltman wrote:
> Hello MattB,
>
> MattB wrote:
>
>> 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


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

Matt


 
Reply With Quote
 
Eric Veltman
Guest
Posts: n/a
 
      12-22-2003
Hello Matt,

MattB wrote:

> Eric Veltman wrote:
>> Hello MattB,
>>
>> MattB wrote:
>>
>>> 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

>
> 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
 
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
confused by boost::bind & boost::lambda::bind XHengDF@gmail.com C++ 0 05-29-2007 04:37 AM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM
trying to bind a typed dataset to a datagrid bill yeager ASP .Net Datagrid Control 1 09-17-2004 02:15 PM
How to bind data from XQuery to a Dataset ?? HNguyen ASP .Net 0 06-03-2004 07:32 PM
Custom control DataSet bind issue jacksu MCSD 0 03-02-2004 04:29 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