473,385 Members | 1,320 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,385 software developers and data experts.

OleDB update command ?

I need some example
I have a dataset populeted through a dataadapter fill method
i can add rows to my dataset , but i have an exception when calling the
dataadpters update method.

I already spent 7 hours to solve this, yet i still am no step further.

I might be missing something around the Updatecommand property of the
oleDBDataAdapter.

Can someone point me to an example or more information ?

Johan

Nov 15 '05 #1
5 13540
Maybe posting the code that causes the error would help ? Its easier to
diagnose that way...JMHO
--
-------------------------------------------------------
http://www.qnal.net/inkabletype

"Sagaert Johan" <RE*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I need some example
I have a dataset populeted through a dataadapter fill method
i can add rows to my dataset , but i have an exception when calling the
dataadpters update method.

I already spent 7 hours to solve this, yet i still am no step further.

I might be missing something around the Updatecommand property of the
oleDBDataAdapter.

Can someone point me to an example or more information ?

Johan

Nov 15 '05 #2

"Sagaert Johan" <RE*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I need some example
I have a dataset populeted through a dataadapter fill method
i can add rows to my dataset , but i have an exception when calling the
dataadpters update method.

I already spent 7 hours to solve this, yet i still am no step further.

I might be missing something around the Updatecommand property of the
oleDBDataAdapter.

Can someone point me to an example or more information ?


There are two things i can think of (at least, that i ran into them myself):
1. You have an autonumber column in the table, but the MissingSchemaAction
property in the data adapter is set to Add, but not AddWithKey.
2. Your table comes from a query, so it's not possible to update the tables
that the data came from.

Miki
Nov 15 '05 #3
I will prepare one and post it.

I am using the design time components on my form.

One of the exceptions i had said i was missing the insert command in the
oledbdataadapter.
This might be were i got stuck with.

"Kunal" <kunal.das[AT]removethis.qnal.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Maybe posting the code that causes the error would help ? Its easier to
diagnose that way...JMHO
--
-------------------------------------------------------
http://www.qnal.net/inkabletype

"Sagaert Johan" <RE*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I need some example
I have a dataset populeted through a dataadapter fill method
i can add rows to my dataset , but i have an exception when calling the
dataadpters update method.

I already spent 7 hours to solve this, yet i still am no step further.

I might be missing something around the Updatecommand property of the
oleDBDataAdapter.

Can someone point me to an example or more information ?

Johan


Nov 15 '05 #4
I always get an invalid INSERT INTO exception

// Create the DataSet object

DataSet oDS = new DataSet();

OleDbConnection conn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=domotica7.mdb");

conn.Open();

// Create the DataTable

OleDbDataAdapter oOrdersDataAdapter = new OleDbDataAdapter(new
OleDbCommand("SELECT * FROM InOut", conn));

OleDbCommandBuilder oOrdersCmdBuilder = new
OleDbCommandBuilder(oOrdersDataAdapter);

oOrdersDataAdapter.FillSchema(oDS, SchemaType.Source);

DataTable pTable = oDS.Tables["Table"];

pTable.TableName = "InOut";

// Insert the Data

DataRow oOrderRow = oDS.Tables["InOut"].NewRow();

oOrderRow["Modulenaam"]="testmodule";

oOrderRow["Omschrijving"] = "informatie";

oOrderRow["SubAdres"] = 123;

oOrderRow["Zone"] = "badkamer";

oDS.Tables["InOut"].Rows.Add(oOrderRow);

//this fails

oOrdersDataAdapter.Update(oDS, "inout");

conn.Close();

"Miki Watts" <mi*****@netvision.net.il> wrote in message
news:KM********************@giganews.com...

"Sagaert Johan" <RE*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I need some example
I have a dataset populeted through a dataadapter fill method
i can add rows to my dataset , but i have an exception when calling the
dataadpters update method.

I already spent 7 hours to solve this, yet i still am no step further.

I might be missing something around the Updatecommand property of the
oleDBDataAdapter.

Can someone point me to an example or more information ?
There are two things i can think of (at least, that i ran into them

myself): 1. You have an autonumber column in the table, but the MissingSchemaAction
property in the data adapter is set to Add, but not AddWithKey.
2. Your table comes from a query, so it's not possible to update the tables that the data came from.

Miki

Nov 15 '05 #5
Found the cause:
one of the field names in my access MDB was the name of a .NET class keyword
..

The INSERT INTO systax error exception seriously misleaded me...
"Miki Watts" <mi*****@netvision.net.il> wrote in message
news:KM********************@giganews.com...

"Sagaert Johan" <RE*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I need some example
I have a dataset populeted through a dataadapter fill method
i can add rows to my dataset , but i have an exception when calling the
dataadpters update method.

I already spent 7 hours to solve this, yet i still am no step further.

I might be missing something around the Updatecommand property of the
oleDBDataAdapter.

Can someone point me to an example or more information ?
There are two things i can think of (at least, that i ran into them

myself): 1. You have an autonumber column in the table, but the MissingSchemaAction
property in the data adapter is set to Add, but not AddWithKey.
2. Your table comes from a query, so it's not possible to update the tables that the data came from.

Miki

Nov 15 '05 #6

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

Similar topics

14
by: | last post by:
Hi, I was performing SQL UPDATE queries and I notice that they SUCCEED on the ExecuteNonQuery() call with NO exceptions raised BUT they fail at the Database. They say they succeed in the code...
1
by: Josef Schneider | last post by:
Given: Data.oledb source, and a Data.odbc target The oledb data is read into a dataset. (1) Is there an easy way to copy that dataset to the target datasource ( I can look through the...
4
by: NS | last post by:
Hi, I am trying to execute a prepare statement using oledb provider for DB2. The command.Prepare() statement is giving me an exception " No error information available:...
2
by: Joe | last post by:
Hi All, I am new to using the Access DB and I need some help if someone is able to give it to me. What I want to do is get the names of the columns of certain tables. Not the data in the table...
8
by: bob | last post by:
Hi.. I'm making a OleDb connection to a access database.. I can fill the dataset fine and view the data, but when I add a new row and try to update the db I get this error. Any help would be...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
1
by: T8 | last post by:
I have a asp.net (framework 1.1) site interfacing against SQL 2000. It runs like a charm 99% of the time but once in a while I get the following "unspecified error". Sometimes it would resolve by...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
13
by: Terry Olsen | last post by:
I'm using OleDb to connect with an Access Database. I have anywhere from 10 to over 100 records that I need to either INSERT if the PK doesn't exist or UPDATE if the PK does exist, all in a single...
2
by: Benedictum | last post by:
I have the following code that derives the value from a query string - // the code -> protected void Page_Load(object sender, EventArgs e) { string theTime = Request.QueryString; string...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.