PC Review


Reply
Thread Tools Rate Thread

Baffled by XML <-> Dataset

 
 
Mat
Guest
Posts: n/a
 
      19th Jul 2003
Help!

I've just started looking into persisting data to SQL 2000 for a .net
application. I have a XML document in the form

<Data>
<Customer>
<ID>1</ID>
<Name>Cust1</Name>
<Address>
<CustId>1</CustId>
<AddressType>1</AddressType>
<Town>A Town</Town>
</Address>
<Address>
<CustId>1</CustId>
<AddressType>2</AddressType>
<Town>A Town</Town>
</Address>
</Customer>
</Data>

Within SQL There are two tables, Customer and Address, which a
relation between both on the CustomerId. CustomerId is a uniqueKey.
If there an easy way to persist the infomation to/from SQL 2000? I've
looked at datasets which are probably the key to the solution (is this
the right track?).


If so, is there anyway of getting the relationship built automatically
within dataset tables, or does this have to be automatic.

Is a dataset with an underlying schema is used, this seems to be
ignored when populating the dataset with the results from the SQL
query.

Can multiple tables /rows be updated within one transaction, as I
don't want to create a network traffic hungry application?

Finally, is there a good WEB site to get this information from? Info
seems a little hard to get on this!

Cheers,
 
Reply With Quote
 
 
 
 
David Keenan
Guest
Posts: n/a
 
      19th Jul 2003
Hi Mat,

You could try using an SqlXml UpdateGram to update your
database. Something like the following should do you.

<?xml version="1.0"?>
<YourDataBaseName
xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
<updg:sync>
<updg:before></updg:before>
<updg:after>
<Customer
updg:at-identity="customerID"
Name="Cust1" />
<Address
CustId="customerID"
AddressType="1"
Town="A Town" />
</updg:after>
</updg:sync>
</YourDataBaseName>

You could apply an xslt stylesheet to your xml to
transform it into the format above.

Hope this helps!

Dave
 
Reply With Quote
 
Kathleen Dollard
Guest
Posts: n/a
 
      30th Jul 2003
Mat,

Can you load the XML into a DataSet? Some you can, and some you can't. Best
to just try it. (ReadXML).

> If so, is there anyway of getting the relationship built automatically
> within dataset tables, or does this have to be automatic.


You'll probably have to set the relation up yourself. It's just a few lines
of code to add a relation to the DataSet.

> Can multiple tables /rows be updated within one transaction, as I
> don't want to create a network traffic hungry application?


I think you mean in one database request - so no. If you mean transaction,
then sure.

> Finally, is there a good WEB site to get this information from? Info
> seems a little hard to get on this!


There are lots of sites. I find .NET has finally taught me to become
competent with Google.
--
Kathleen (MVP-VB)



"Mat" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Help!
>
> I've just started looking into persisting data to SQL 2000 for a .net
> application. I have a XML document in the form
>
> <Data>
> <Customer>
> <ID>1</ID>
> <Name>Cust1</Name>
> <Address>
> <CustId>1</CustId>
> <AddressType>1</AddressType>
> <Town>A Town</Town>
> </Address>
> <Address>
> <CustId>1</CustId>
> <AddressType>2</AddressType>
> <Town>A Town</Town>
> </Address>
> </Customer>
> </Data>
>
> Within SQL There are two tables, Customer and Address, which a
> relation between both on the CustomerId. CustomerId is a uniqueKey.
> If there an easy way to persist the infomation to/from SQL 2000? I've
> looked at datasets which are probably the key to the solution (is this
> the right track?).
>
>
> If so, is there anyway of getting the relationship built automatically
> within dataset tables, or does this have to be automatic.
>
> Is a dataset with an underlying schema is used, this seems to be
> ignored when populating the dataset with the results from the SQL
> query.
>
> Can multiple tables /rows be updated within one transaction, as I
> don't want to create a network traffic hungry application?
>
> Finally, is there a good WEB site to get this information from? Info
> seems a little hard to get on this!
>
> Cheers,



 
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
Re: Really baffled.. Davej DIY PC 0 15th Sep 2011 01:21 PM
Re: BAFFLED!! please help! Clark Windows Vista Hardware 0 3rd Feb 2009 08:32 PM
Baffled? =?Utf-8?B?VHJ1?= Microsoft Access Reports 5 5th Feb 2006 05:16 PM
Baffled ! Neville DIY PC 5 24th Nov 2003 10:45 PM
Baffled! Richard Microsoft Excel Programming 2 24th Sep 2003 06:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:51 AM.