Dataadapter not updating datatable

Rated 3.91/5 based on 600 customer reviews

Update(tblx) '--tblx/tbl1 not getting updated here. But if I do this---then it works OK (not using data Adapter though) Dim cmd As New Sql Command cmd. Command Text = "Update tbl1 set fld1 = 'test' where ID = 1" da. But when I was trying to use the Adapter - I was not updating tblx which is what updates tbl1 on the sql server.

Then I updated the items in the datarow that I wanted to change. Now I can see the update in tblx(datatable) tbl1 (sql server table). It does the same with the delete and the insert by the way. Command Text = "UPDATE Sample SET What Ever = @What Ever WHERE (Auto Id = @Original_Auto Id) " & _ "AND (What Ever = @Original_What Ever OR @Original_What Ever IS NULL AND What Ever IS NULL); " & _ "SELECT Auto Id, What Ever FROM Sample WHERE (Auto Id = @Auto Id)" cmd Update. But when I was trying to use the Adapter - I was not updating tblx which is what updates tbl1 on the sql server. "Cor Ligthert [MVP]" wrote: Rich, I have seen those messages about the commandbuilder as well. Add(New Sql Parameter("@Original_Auto Id", Sql Db Type. Input, False, nb, nb, _ "Auto Id", Data Row Version. Original, Nothing)) ' What you see is that there is a Update and a Select in it. Add(New Sql Parameter("@p1, Sql DBtype.varchar, 10, "fld1") Dim dr As Data Row = tblx. Update(tblx) '--now I can see the update in tblx/tbl1 the example using cmd was only updating tbl1 on the sql server. Update(tblx) '--tblx/tbl1 not getting updated here. But if I do this---then it works OK (not using data Adapter though) Dim cmd As New Sql Command cmd. May I ask what the Select statement in the Update Command performs? Add(New Sql Parameter("@Original_What Ever", _ Sql Db Type. Input, False, nb, nb, _ "What Ever", Data Row Version. Command Text = "Update tbl1 set fld1 = 'test' where ID = 1" da. But for the code about concurrency checking focus your eyes only on that update command that is in the sample on our website. Command Text = "UPDATE Sample SET What Ever = @What Ever WHERE (Auto Id = @Original_Auto Id) AND (What Ever = @Original_What Ever OR @Original_What Ever IS NULL AND What Ever IS NULL); " & _ "SELECT Auto Id, What Ever FROM Sample WHERE (Auto Id = @Auto Id)" I use a Select statement in the Insert Command in order to retrieve @@Identity from a sql table. Command Text = "Update tbl1 set fld1 = 'test' where ID = 1" conn. This is not a guarantee of course that there cannot be something wrong. dim cmb as new SQLCommand Builder(da) I hope this helps, Cor "Rich" Thank you. It appears that the concurrency check comes from the commandtext cmd Update.

Leave a Reply