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 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
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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)
{
|
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
|
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" %>
|
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);...
|
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...
| |
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)
|
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...
|
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?
...
|
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."...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |