|
-
Aug 19th, 2012, 04:50 PM
#1
Thread Starter
Lively Member
Update Fails (Access db)
This is making me nuts!
Sub AddElement(ByVal newItem As String)
Dim cb As New OleDb.OleDbCommandBuilder(daFinishes)
Dim dsNewRow As DataRow
dsNewRow = dsFinishes.Tables("tblFinishes").NewRow()
dsNewRow.Item("Finish") = newItem
dsFinishes.Tables("tblFinishes").Rows.Add(dsNewRow)
Try
daFinishes.Update(dsFinishes, "tblFinishes")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
The dataset is OK and is available in the app. When a new item is added,
it too is OK and appears in the dataset. But, the Access 2010 db will not
update. The db table has only 2 columns: an 'ID' (which is primary key)
and a text column named 'Finish.' The table "tblFinishes" is one of 8
tables in the db but is the only table in the dataset. (SELECT * from
tblFinishes)
The error from the 'Try ... catch" is: "Dynamic SQL generation is not
supported against a Select command that does not return any base table
info"
To add to the frustration, as a test I removed the routine, placed it in a stand alone app and it worked as it should.
There are a lot of posts about this but mostly they talk about absence of a primary key which is not the problem here.
Is the needed PK info somehow 'lost' after the sql select? Is this salvageable? Is there another way ... maybe a better way? I am very new to this having just bubbled up from vb6.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|