473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

OleDbDataAdapter Update method...

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
Nov 20 '05 #1
2 4362
Is your ID field a primary key? If not, try that

"Zuy Tran" <zt***@sbcglobal.net> wrote in message
news:aP*******************@newssvr29.news.prodigy. com...
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

Nov 20 '05 #2
Is your ID field a primary key? If not, try that

"Zuy Tran" <zt***@sbcglobal.net> wrote in message
news:aP*******************@newssvr29.news.prodigy. com...
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

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris Mayers | last post by:
Hi, Hope someone can explain this... OK, here is the simplest subset of my code that shows the problem: I have a C# Method: Private void UpdateDataTable(DataTable myDT) {
2
by: Son Ha | last post by:
I want to copy some record from a Access database to another Access DB. My code as follow but not working. The destAdapter.Update() return 0 record affected. Tell me what's wrong in my code? ...
1
by: amessimon | last post by:
Hi I have a problem with an insert statment using the update() method of the OledbDataAdapter. I'm getting the error 'Update requires a valid InsertCommand when passed DataRow collection with...
1
by: Bennett Haselton | last post by:
Suppose I add a new row to a table in a dataset, and then I use an OleDbDataAdapter to add that new row to a SQL Server database using OleDbDataAdapter.Update(), as in the following code: ...
0
by: Zuy Tran | last post by:
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...
5
by: Al | last post by:
Hi, I need to update tables in access 97. The table names have spaces (not my choice). My update fails even though I use the OleDbCommandBuilder. Here is a code I am using myDataAdapter = New...
6
by: Marcel Hug | last post by:
Hi all ! I have a table in my database, which has 3 attributes. IDFailureControl, ControlDate and ControlVersion. In the following function I test, if the date of today allready exists. Then I...
6
by: tom c | last post by:
I create 2 data OleDbDataAdapters, one with the wizard, and one in code. I know the adapter created in code is OK because I use it to fill a data table. However, when I try to use the same SQL...
2
by: explode | last post by:
I made nova oledbdataadapter select update insert and delete command and connection veza. dataset is Studenti1data, I made it by the new data source wizard,and made datagridview and bindingsource...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.