473,659 Members | 3,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating Access DB with changes from a DataSet results in error.

Hi All

I have a OleDbConnection as the "connection " below. I'm retriving a dataset from an access 2002 db and displaying it in a DataGrid. I'm making the connection to my access db file with this connection string

"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" + filename

and everything is working fine with that. My table in the database is simple. 10 columns of text or numbers. No joining or anything else. It has a autonumber as the primary key. Simple enough.

// Update Code
OleDbDataAdapte r adapter = new OleDbDataAdapte r(sql, this.connection );

OleDbCommandBui lder ocb = new OleDbCommandBui lder(adapter);

adapter.Update( ds, QueryConstants. RACETABLENAME);
// End update Code

When I try to call the update above to save the changes I have made via the DataGrid, I get this error.

Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.

From what I can find about this error it may have something to do with the way I'm connection to the data source or the way the datasource is setup (primary keys....) but as much as I know and have tried I cannot resolve this problem.

I also have this application working from a sql server connection with the same table and data setup as the access file. And when i use the SqlConnection instead of the OleDbConnection everything works fine.

I know this may seem jumbled but if anyone had this problem and got it solved please let me know. I also read something about if the db driver you are using dosen't support returning schema information about the table then the command builder can't do its thing. I just don't see why microsofts own product wouldn't support that.

I have updated to the lastest Jet Driver (SP7) and still no fix. Please help
Thanks
Bryan
Nov 15 '05 #1
1 1690
Bryan,
Check to make sure that none of your field names are reserved words.
You can work around this by setting QuotePrefix and QuoteSuffix on the
CommandBuilder (usually to '[' and ']' for access).
If this doesn't work you check the rest of your logic. I guess that you
have left some things out as I don't see a Fill statement for your table or
other means of associating the DataAdapter with a Table.

You may get more responses for this type of question in
microsoft.publi c.dotnet.framew ork.adonet as well.
Ron Allen
"Bryan Masephol" <ma******@uwec. edu> wrote in message
news:eb******** ******@TK2MSFTN GP12.phx.gbl...
Hi All

I have a OleDbConnection as the "connection " below. I'm retriving a dataset
from an access 2002 db and displaying it in a DataGrid. I'm making the
connection to my access db file with this connection string

"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" + filename

and everything is working fine with that. My table in the database is
simple. 10 columns of text or numbers. No joining or anything else. It
has a autonumber as the primary key. Simple enough.

// Update Code
OleDbDataAdapte r adapter = new OleDbDataAdapte r(sql, this.connection );

OleDbCommandBui lder ocb = new OleDbCommandBui lder(adapter);

adapter.Update( ds, QueryConstants. RACETABLENAME);
// End update Code

When I try to call the update above to save the changes I have made via the
DataGrid, I get this error.

Dynamic SQL generation is not supported against a SelectCommand that does
not return any base table information.

From what I can find about this error it may have something to do with the
way I'm connection to the data source or the way the datasource is setup
(primary keys....) but as much as I know and have tried I cannot resolve
this problem.

I also have this application working from a sql server connection with the
same table and data setup as the access file. And when i use the
SqlConnection instead of the OleDbConnection everything works fine.

I know this may seem jumbled but if anyone had this problem and got it
solved please let me know. I also read something about if the db driver you
are using dosen't support returning schema information about the table then
the command builder can't do its thing. I just don't see why microsofts own
product wouldn't support that.

I have updated to the lastest Jet Driver (SP7) and still no fix. Please
help
Thanks
Bryan
Nov 15 '05 #2

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

Similar topics

2
1799
by: Irvin | last post by:
I new to ASP.net and am using the following code to attempt to update an Access 2000 mdb. The code does make it through the code following "try". NO rows are updated. There is a row with the work_id of 1343. What Am I missing? Your help is appreciated. Irvin Amoraal. <>< ______________________ <%@ Page Language="VB" Debug="true" %> <%@ import Namespace="System.Data" %>
0
1759
by: | last post by:
I am updating MS access tables with data in an xml document. I create two dataset, one for existing data and one for new data. I fill the first dataset with the records from MS Access, the second with data from the xml Document. Both datasets are populated properly. When the new data contains records that exist in the existing Access table but with changes in individual elements, the matching records in the first dataset are not changed...
3
13048
by: Tc | last post by:
Hi, I was curious, I am thinking of writing an application that loads a dataset from a database that resides on a server. The question I have is this, if multiple copies of the app will be running at once will there be problems with data updates? The reason I ask is I'm thinking like this: User1 launches the app and the dataset is created from the data in the DB.
5
2026
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
14
2117
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these grid and write to the database and I set the new Primary Keys and related Fields to the new asigned atuonumbers in the Access.
2
1824
by: Niels Jensen | last post by:
I have a some code which imports information from a text file to a dataset. Depending op what is being extracted from the text file, the dataset has 5 tables which can be written to. During this accessing I have to delete some records depending on certain criteria. I initially had some errors because I wasn't accepting the changes made to the dataset. So using .acceptchanges fixed the issue. however later on in the program a user may...
3
8922
by: RSH | last post by:
Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment. Both servers contain the same databases but I need to write a utility that can transfer a row of data from the Production to the Development servers. I wrote the code below, which doesn't error...but it doesn't work...no data is updated. This is very odd because I can see that both of...
0
882
by: Peter Newman | last post by:
VB.net ( 2003 ) & SQL 2005 Thank you for all the help in navigating through the dataset using the CurrencyManager. However im now stuck on the next part , Updating, and addind records. how can i 1. Client_RS.HasChanges(DataRowState.Modified), update the dataset with the amended data and pass that through to the SQL server. Can this be done through the dataset
6
2330
by: mike11d11 | last post by:
I'm trying to create an application that will have multiple users working off a table on a SQL server. Since multi users will be updating different records at any given moment, how can i get those changes and merge them into my current Dataset. I've been playing around with the GetChanges method and Acceptchanges but they just dont seem to be pulling over the changes and updating my Dataset. Maybe if someone could give me a sample of...
0
8428
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, 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...
0
8337
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
8628
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
6181
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
5650
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
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
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
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.