Unable to update rows in a dataset.

  • Thread starter Thread starter Robert Adrian
  • Start date Start date
R

Robert Adrian

I am having troubles updating a row in a dataset. I am
not receiving any errors, it's just not updating. Please
help!

Dim DataAdapter As New SqlClient.SqlDataAdapter(strSQL,
strConn)

Dim DataSet As New Data.DataSet
Dim CommandBuilder As New SqlClient.SqlCommandBuilder
(DataAdapter)

DataAdapter.Fill(DataSet)

Dim Row As DataRow
Row = DataSet.Tables(0).Rows(0)

Row("Key1") = txtKeyword1.Text

DataAdapter.Update(DataSet)
 
Hi Robert,

Are you sure that:
1. The strSQL statement access only one table?
2. The strSQL statement must also return at least one primary key or unique
column?

SqlCommandBuilder only works if all above conditions are met.

Hope this help,

Dinhduy

MCSD/MCSD.Net
 
Back
Top