473,804 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OleDbDataAdapte r Update method...

I'm trying to update my data source using the Update method in
OleDbDataAdapte r 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=Micro soft.Jet.OLEDB. 4.0;Data
Source="C:\myDa taFile.mdb;Mode =ReadWrite|Shar e Deny None"
mDBAdapter = new OleDbDataAdapte r ()
mDBAdapter.Sele ctCommand = New OleDbCommand ("Select Id, Pacakge from
_mPackage Where Obsolete=0 Order By Package", mDBConn)
mDBCmdBuilder = new OleDbCommandBui lder (mDBAdapter)
mDBDataSet = new DataSet()
mDBConn.Open
mDBAdapter.Fill (mDBDataSet, "_mPackage" )
Try
Din nRow as Integer = mDBAdapter.Upda te (mDBDataSet, "_mPackage" )
Catch oEx as System.Exceptio n
MessageBox.Show (oEx.Message)
End Try
mDBConn.Close

Thanks for your help
Nov 20 '05 #1
2 4402
Is your ID field a primary key? If not, try that

"Zuy Tran" <zt***@sbcgloba l.net> wrote in message
news:aP******** ***********@new ssvr29.news.pro digy.com...
I'm trying to update my data source using the Update method in
OleDbDataAdapte r 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=Micro soft.Jet.OLEDB. 4.0;Data
Source="C:\myDa taFile.mdb;Mode =ReadWrite|Shar e Deny None"
mDBAdapter = new OleDbDataAdapte r ()
mDBAdapter.Sele ctCommand = New OleDbCommand ("Select Id, Pacakge from
_mPackage Where Obsolete=0 Order By Package", mDBConn)
mDBCmdBuilder = new OleDbCommandBui lder (mDBAdapter)
mDBDataSet = new DataSet()
mDBConn.Open
mDBAdapter.Fill (mDBDataSet, "_mPackage" )
Try
Din nRow as Integer = mDBAdapter.Upda te (mDBDataSet, "_mPackage" )
Catch oEx as System.Exceptio n
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***@sbcgloba l.net> wrote in message
news:aP******** ***********@new ssvr29.news.pro digy.com...
I'm trying to update my data source using the Update method in
OleDbDataAdapte r 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=Micro soft.Jet.OLEDB. 4.0;Data
Source="C:\myDa taFile.mdb;Mode =ReadWrite|Shar e Deny None"
mDBAdapter = new OleDbDataAdapte r ()
mDBAdapter.Sele ctCommand = New OleDbCommand ("Select Id, Pacakge from
_mPackage Where Obsolete=0 Order By Package", mDBConn)
mDBCmdBuilder = new OleDbCommandBui lder (mDBAdapter)
mDBDataSet = new DataSet()
mDBConn.Open
mDBAdapter.Fill (mDBDataSet, "_mPackage" )
Try
Din nRow as Integer = mDBAdapter.Upda te (mDBDataSet, "_mPackage" )
Catch oEx as System.Exceptio n
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
1603
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
3821
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? public void CopyDataSet(int start, int end) { OleDbDataAdapter sourceAdapter = new OleDbDataAdapter("SELECT * FROM " + "WHERE ID > " + (start - 1).ToString() + " AND .id < " + (end + 1).ToString(), connectionString
1
1195
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 new rows. ' Heres a condensed version of the page. <%@ Import Namespace="system.Data" %> <%@ Import Namespace="system.Data.Oledb" %>
1
5094
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: dsLocalDataSet.user_postRow newRow = dsLocalDataSet1.user_post.Newuser_postRow(); newRow.post_text = this.lblHiddenMessageStorage.Text; newRow.post_datetime = System.DateTime.Now; dsLocalDataSet1.user_post.Adduser_postRow(newRow);...
0
322
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 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...
5
3698
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 OleDbDataAdapter myDataAdapter.SelectCommand = New OleDbCommand("Select * from ", MyConnection) Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(PatientsBillingDataAdapter)
6
14918
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 would like to write the new ControlDate or Version into the database. First i update the dataset, then i create a Insertcommand and call the update-methode. All datas are in the database, but.... 1.) If I only use the InsertCommand, without...
6
1868
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 insert statement in the two adapters, the adapter created with the wizard works fine, but the adapter created in code gives me an error "Object reference not set to an instance of an object". The code is below. What am I doing wrong? ...
2
2934
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 draging Table1 to Form2. The select command works fine, but when I change the data and call update command I get a syntax error: System.Data.OleDb.OleDbException was unhandled ErrorCode=-2147217900 Message="Syntax error in UPDATE statement."...
0
9576
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10311
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2988
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.