brandonyoung
Member
- Joined
- Apr 26, 2011
- Messages
- 12
- Programming Experience
- 3-5
Hi if anyone could offer any advice I would be very grateful.....
I'm trying to write to a spot in a database and am getting this error message:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
Here is my code
Sub addSpot(ByRef row As Integer, ByRef col As Integer, ByRef value As String)
Dim con As New OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim databaseName As String = "C:/The Ascot Day Nursery.mdb"
dbProvider = ("PROVIDER=Microsoft.Jet.OLEDB.4.0;")
dbSource = ("Data Source = C:/The Ascot Day Nursery.mdb")
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * FROM brandontable"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "AddressBook")
Dim cb As New OleDb.OleDbCommandBuilder(da)
ds.Tables("AddressBook").Rows(row).Item(col) = value
da.Update(ds, "AddressBook")
con.Close()
End Sub
I'm trying to write to a spot in a database and am getting this error message:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
Here is my code
Sub addSpot(ByRef row As Integer, ByRef col As Integer, ByRef value As String)
Dim con As New OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim databaseName As String = "C:/The Ascot Day Nursery.mdb"
dbProvider = ("PROVIDER=Microsoft.Jet.OLEDB.4.0;")
dbSource = ("Data Source = C:/The Ascot Day Nursery.mdb")
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * FROM brandontable"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "AddressBook")
Dim cb As New OleDb.OleDbCommandBuilder(da)
ds.Tables("AddressBook").Rows(row).Item(col) = value
da.Update(ds, "AddressBook")
con.Close()
End Sub