Xml > DataSet >Database

  • Thread starter Thread starter Nathan Pledger via .NET 247
  • Start date Start date
N

Nathan Pledger via .NET 247

Hello,

As the subject says, we need to take data from an XML definition,which has been loaded through the XmlDocument type into theADO.NET way of doing things using a DataSet. This works nicely.

However, we now need to submit that to the database, and we wouldbe very grateful if you coulf please give us some advice on howto submit the data in the Xml to the database. Please considerthat this final step of submtting data to the Database from theDataSet having been sourced from an Xml source is the finerpoint we are after.

Thanks in advance.

Nathan
 
The DataSet needs to have its Rows with Rowstates of Added or Modified in
order to use an Adapter w/update command.

So first, make sure you have a valid update command for the dataadapter.
Then make sure the DataSet.HasChanges= true otherwise nothign will happen
when you call update.

Let me konw if you have an update command already and please verify the
HasChanges, we'll move forward from there.

Cheers,

Bill
Hello,

As the subject says, we need to take data from an XML definition, which has
been loaded through the XmlDocument type into the ADO.NET way of doing
things using a DataSet. This works nicely.

However, we now need to submit that to the database, and we would be very
grateful if you coulf please give us some advice on how to submit the data
in the Xml to the database. Please consider that this final step of
submtting data to the Database from the DataSet having been sourced from an
Xml source is the finer point we are after.

Thanks in advance.

Nathan
 
Cheers for your reply.

Our key problem is setting up the update command for the dataadapter.

We have the populated dataset the schema of which was defined by an
xsd file, however we do not know how to get this content into the
database.
How do you set up the dataadapter and the commands?

Cheers.
 
You can use a commandbuilder and as long as you have a SELECT COmmand and
there's a key on the table in the backend db, it will do it for you.
However, in this case, won't work. You can write an update statement
yourself specifying command parameters, or just use the
DataAdapterconfiguration wizard. Pick the table you want update, pick the
fields (make sure they matcth the dataset) and then just call update. It
will take care of most everythign for you.

HTH,

Bill
 
Back
Top