Unable to update rows in a dataset.

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)
 
D

Dinhduy Tran

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top