Hi, Im using vb.net 2010 express, ADO and sql server 2008 express.
I have a simple table that I create a dataset from, consisting of 2 small tables and then when I edit TblClient data and try to update that table back to the sql server database I get an error.
The dataset is called 'ds' tables are TblClient (PK ID, FName, Surname) with only 1 record in it and TblOtherServices (ID, ClientID, OtherService, SDate) which is in a datagridview
see ,y code below Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click '*****************
'BEGIN SEND CHANGES TO SQL SERVER
Dim objCommandBuilder As New SqlCommandBuilder(da)
'Assign new Values to row items
ds.Tables("TblClient").Rows(0).Item("ID") = Convert.ToInt32(ID.Text)
ds.Tables("TblClient").Rows(0).Item("FName") = FName.Text
ds.Tables("TblClient").Rows(0).Item("Surname") = Surname.Text
da.Update(ds.Tables("TblClients"))
MsgBox("SQL Server updated successfully" & Chr(13) & "Check Server explorer to see changes")
' END SEND CHANGES TO SQL SERVER
End Sub
The error stated column Client ID not found in TblClient see attached.
I have tried deleting the 2nd table from the dataset and then updating the dataset but I get the same result!
Any suggestions....
I have a simple table that I create a dataset from, consisting of 2 small tables and then when I edit TblClient data and try to update that table back to the sql server database I get an error.
The dataset is called 'ds' tables are TblClient (PK ID, FName, Surname) with only 1 record in it and TblOtherServices (ID, ClientID, OtherService, SDate) which is in a datagridview
see ,y code below Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click '*****************
'BEGIN SEND CHANGES TO SQL SERVER
Dim objCommandBuilder As New SqlCommandBuilder(da)
'Assign new Values to row items
ds.Tables("TblClient").Rows(0).Item("ID") = Convert.ToInt32(ID.Text)
ds.Tables("TblClient").Rows(0).Item("FName") = FName.Text
ds.Tables("TblClient").Rows(0).Item("Surname") = Surname.Text
da.Update(ds.Tables("TblClients"))
MsgBox("SQL Server updated successfully" & Chr(13) & "Check Server explorer to see changes")
' END SEND CHANGES TO SQL SERVER
End Sub
The error stated column Client ID not found in TblClient see attached.
I have tried deleting the 2nd table from the dataset and then updating the dataset but I get the same result!
Any suggestions....