all groups > visual studio .net general > november 2006 >
You're in the

visual studio .net general

group:

dataadapter.update problem


dataadapter.update problem Steve Lloyd
11/29/2006 6:51:43 PM
visual studio .net general:
Hi all,

I am having trouble updating a DataSet via a DataAdapter, all the
documentation says it should feed back the unique id of the sql table but
after the .update the ID is still the one generated from the dataset. The
SQL table updates perfectly with the new unique ID and all of the required
data.

Any help would be very greatly appreciated

Thanks, Steve

Here is what I have to fill that dataset:
dbCommand.CommandText = SQLQueryString
TemplateAdapter.SelectCommand = dbCommand
TemplateAdapter.FillSchema(DataSetTemplate, SchemaType.Source, "Template")
TemplateAdapter.Fill(DataSetTemplate, "Template")

Then i do this to update it:
Dim oCommandBuilder As SqlCommandBuilder = New
SqlCommandBuilder(TemplateAdapter)
oCommandBuilder.SetAllValues = True
TemplateAdapter.InsertCommand = oCommandBuilder.GetInsertCommand
TemplateAdapter.FillLoadOption = LoadOption.OverwriteChanges
TemplateAdapter.AcceptChangesDuringUpdate = True
TemplateAdapter.AcceptChangesDuringFill = True

TemplateAdapter.Update(DataSetTemplate, "Template")

DataSetTemplate.AcceptChanges()

Re: dataadapter.update problem Steve Lloyd
11/30/2006 12:00:00 AM
S'ok, got there in the end. I used the rowupdated event to return the
@@identity from the insertcommands sqlconnection.

Sorry for the premature posting.

[quoted text, click to view]

AddThis Social Bookmark Button