Hi,
I have some strange problems with the update of a dataadapter.
First, I read a row in a table, through a dataset :
Quote:
|
quote:da = New SqlDataAdapter(sql, conn)
|
Quote:
ds = New DataSet
da.Fill(ds, "MyTable")
da.SelectCommand.CommandText = "select * from address"
Dim sqlBuilder As SqlCommandBuilder = New SqlCommandBuilder(da)
da.InsertCommand = sqlBuilder.GetInsertCommand()
da.DeleteCommand = sqlBuilder.GetDeleteCommand()
da.UpdateCommand = sqlBuilder.GetUpdateCommand()
ta = ds.Tables("MyTable")
pka(0) = ta.Columns("address_id")
ta.PrimaryKey = pka
dim dr As DataRow
dr = ta.Rows.Find(1) 'get the address with id 1
|
Then I update a field :
Quote:
|
quote:dr("country_id") = system.dbnull.value
|
and now I commit the change :
But changes are not reflected in the database....
The update command doesn't work with this update. If country_id value is not null, it works...
I precise that country_id is nullable in the DB.
Thanks for any help.
Best regards.
Arthur