OleDbDataAdapter Update method...

Z

Zuy Tran

I'm trying to update my data source using the Update method in
OleDbDataAdapter with automatic command generation and I got error "Dynamic
SQL generation for the UpdateCommand is not supported against a
SelectCommand that does not return any key column information.". Does any
one know what I am missing? My codes look like this:

' Where the connection string is "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source="C:\myDataFile.mdb;Mode=ReadWrite|Share Deny None"
mDBAdapter = new OleDbDataAdapter ()
mDBAdapter.SelectCommand = New OleDbCommand ("Select Id, Pacakge from
_mPackage Where Obsolete=0 Order By Package", mDBConn)
mDBCmdBuilder = new OleDbCommandBuilder (mDBAdapter)
mDBDataSet = new DataSet()
mDBConn.Open
mDBAdapter.Fill (mDBDataSet, "_mPackage")
Try
Din nRow as Integer = mDBAdapter.Update (mDBDataSet, "_mPackage")
Catch oEx as System.Exception
MessageBox.Show (oEx.Message)
End Try
mDBConn.Close

Thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top