G
Guest
Dim da As New SqlDataAdapter("Select * from tbl1", conn)
dim tblx As New DataTable
da.Fill(tblx) '--works OK up to this point
da.UpdateCommand = New SqlCommand
da.UpdateCommand.Connection = conn
da.UpdateCommand.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1"
da.Update(tblx) '--tblx/tbl1 not getting updated here.
But if I do this---then it works OK (not using dataAdapter though)
Dim cmd As New SqlCommand
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1"
conn.Open
cmd.ExecuteNonQuery
cmd.Close
This does update tbl1 correctly. But I need to use the dataAdapter. What
do I need to do to the dataAdapter.UpdateCommand code to make that update
correctly?
Thanks,
Rich
dim tblx As New DataTable
da.Fill(tblx) '--works OK up to this point
da.UpdateCommand = New SqlCommand
da.UpdateCommand.Connection = conn
da.UpdateCommand.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1"
da.Update(tblx) '--tblx/tbl1 not getting updated here.
But if I do this---then it works OK (not using dataAdapter though)
Dim cmd As New SqlCommand
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1"
conn.Open
cmd.ExecuteNonQuery
cmd.Close
This does update tbl1 correctly. But I need to use the dataAdapter. What
do I need to do to the dataAdapter.UpdateCommand code to make that update
correctly?
Thanks,
Rich