W
Wanda
Hello,
I tried to update a row in a table by using the datarow and data
adapter. Unfortunately, it doesn't update.
I try finding that datarow and set it to "dr", I can see dr could be
just an instance of the row, but aren't linked to the table. Is that
why it doesn't update? If not, what is missing? Please help!!!
Dim da As New SqlDataAdapter("select * from Table1", cn)
Dim ds As New DataSet()
Dim dr As DataRow
da.Fill(ds, "Table1")
Dim keys(0) As DataColumn
keys(0) = ds.Tables(Table1").Columns("ID")
ds.Tables("Table1").PrimaryKey = keys
dr = ds.Tables("Table1").Rows.Find (1)
dr.BeginEdit()
dr("F1") = "xxx"
dr.EndEdit()
dr.AcceptChanges()
da.Update(ds, "Table1")
Thanks in advance.
Wanda
I tried to update a row in a table by using the datarow and data
adapter. Unfortunately, it doesn't update.
I try finding that datarow and set it to "dr", I can see dr could be
just an instance of the row, but aren't linked to the table. Is that
why it doesn't update? If not, what is missing? Please help!!!
Dim da As New SqlDataAdapter("select * from Table1", cn)
Dim ds As New DataSet()
Dim dr As DataRow
da.Fill(ds, "Table1")
Dim keys(0) As DataColumn
keys(0) = ds.Tables(Table1").Columns("ID")
ds.Tables("Table1").PrimaryKey = keys
dr = ds.Tables("Table1").Rows.Find (1)
dr.BeginEdit()
dr("F1") = "xxx"
dr.EndEdit()
dr.AcceptChanges()
da.Update(ds, "Table1")
Thanks in advance.
Wanda