473,395 Members | 2,006 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,395 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 4364
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.