|
-
Sep 2nd, 2012, 01:48 PM
#1
Thread Starter
Lively Member
[RESOLVED] Update Fails
I originally posted this problem a few weeks ago but never got it solved.
I moved on to other parts of the app development but this is now critical!
dsFinishes does fill properly, is used successfully and accepts new info.
But, the 'Update' does not update the db.
This is the error from the "Try ... Catch"
"Dynamic SQL generation is not supoorted against a Select Cammand that does
not return any base table information"
The db is Access 2010 and it has a primary key ('ID') generated by Access.
There are several tables in the db but this dataset has only the one. There
are only 2 columns: "Finish" and "ID"
-------------------------------------------------------------------
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dbProvider = "Provider=Microsoft.ACE.OLEDB.12.0;"
dbSource = "Data Source = C:\Framing\Data\Components.accdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
strSelect = "SELECT * FROM tblFinishes ORDER BY ID"
daFinishes = New OleDb.OleDbDataAdapter(strSelect, con)
daFinishes.Fill(dsFinishes, "tblFinishes")
MaxRowsFinishes = dsFinishes.Tables("tblFinishes").Rows.Count
End Sub
---------------------------------------------------------------------
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
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
|