473,396 Members | 2,033 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,396 software developers and data experts.

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=Microsoft.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
OleDbDataAdapter adapter = new OleDbDataAdapter(sql, this.connection);

OleDbCommandBuilder ocb = new OleDbCommandBuilder(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 1680
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.public.dotnet.framework.adonet as well.
Ron Allen
"Bryan Masephol" <ma******@uwec.edu> wrote in message
news:eb**************@TK2MSFTNGP12.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=Microsoft.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
OleDbDataAdapter adapter = new OleDbDataAdapter(sql, this.connection);

OleDbCommandBuilder ocb = new OleDbCommandBuilder(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
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...
0
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...
3
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...
5
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...
14
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...
2
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...
3
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...
0
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...
6
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...
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: 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
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
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...

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.