rehan.azher
Member
- Joined
- Jan 1, 2009
- Messages
- 11
- Programming Experience
- Beginner
Dear All ,
I am using below code to update a record in a table on SQL server 2000.
It was running sucessfully on while SQL Server was on local machine, now my SQL Server is on network and I get following Exception.
"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."
can any one help me in this regard.
Thanks and best regards,
I am using below code to update a record in a table on SQL server 2000.
VB.NET:
With frmMain
.myConnection.Open()
.comUserSelect = New SqlCommand("SELECT customerID, company, cname, chp, cop, cemail, cname2, chp2, cop2, cemail2 FROM tbl_Customer WHERE (customerID = " & j & ")", .myConnection)
.myAdapter = New SqlDataAdapter("SELECT customerID, company, cname, chp, cop, cemail, cname2, chp2, cop2, cemail2 FROM tbl_Customer WHERE (customerID = " & j & ")", .myConnection)
.myDataset = New DataSet()
.mydataTable = New DataTable()
.myAdapter.Fill(.myDataset, "customers")
Dim cb As New SqlCommandBuilder(.myAdapter)
.myDataset.Tables(0).PrimaryKey = New DataColumn() {.myDataset.Tables(0).Columns(0)}
'Label3.Text = .myDataset.Tables(0).Rows(0)(0)
.myDataset.Tables(0).Rows(0)(1) = TextBox4.Text
.myDataset.Tables(0).Rows(0)(2) = TextBox5.Text
.myDataset.Tables(0).Rows(0)(3) = TextBox6.Text
.myDataset.Tables(0).Rows(0)(4) = TextBox7.Text
.myDataset.Tables(0).Rows(0)(5) = TextBox8.Text
.myDataset.Tables(0).Rows(0)(6) = TextBox12.Text
.myDataset.Tables(0).Rows(0)(7) = TextBox11.Text
.myDataset.Tables(0).Rows(0)(8) = TextBox10.Text
.myDataset.Tables(0).Rows(0)(9) = TextBox9.Text
.myAdapter.Update(.myDataset, "customers")
.disposeAll()
MsgBox("Details Updated")
filldv()
End With
It was running sucessfully on while SQL Server was on local machine, now my SQL Server is on network and I get following Exception.
"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."
can any one help me in this regard.
Thanks and best regards,