473,385 Members | 2,015 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 Question

bob
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...
--------------------------------------------------------------------------------
OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood
Nov 15 '05 #1
8 1595
You are using a reserved word "Name" as a field name. You can change your
update command so it wraps Name like this [Name] but I'd Really recommend
not using a reserved word. Chances are either your or another programmer
will forget about it in the future and you'll spend time having to track it
down.

HTH,

Bill
"bob" <pe***********@yahoo.com> wrote in message
news:90*************************@posting.google.co m...
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...
-------------------------------------------------------------------------- ------

OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood

Nov 15 '05 #2
You are using a reserved word "Name" as a field name. You can change your
update command so it wraps Name like this [Name] but I'd Really recommend
not using a reserved word. Chances are either your or another programmer
will forget about it in the future and you'll spend time having to track it
down.

HTH,

Bill
"bob" <pe***********@yahoo.com> wrote in message
news:90*************************@posting.google.co m...
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...
-------------------------------------------------------------------------- ------

OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood

Nov 15 '05 #3
bob
Thanks for the response.. I changed "name" to a more appropriate name
that is not a reserved word, but I still get the same error...

"William Ryan eMVP" <bi**@NoSp4m.devbuzz.com> wrote in message news:<Oh**************@TK2MSFTNGP11.phx.gbl>...
You are using a reserved word "Name" as a field name. You can change your
update command so it wraps Name like this [Name] but I'd Really recommend
not using a reserved word. Chances are either your or another programmer
will forget about it in the future and you'll spend time having to track it
down.

HTH,

Bill
"bob" <pe***********@yahoo.com> wrote in message
news:90*************************@posting.google.co m...
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...
--------------------------------------------------------------------------

------


OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood

Nov 15 '05 #4
bob
Thanks for the response.. I changed "name" to a more appropriate name
that is not a reserved word, but I still get the same error...

"William Ryan eMVP" <bi**@NoSp4m.devbuzz.com> wrote in message news:<Oh**************@TK2MSFTNGP11.phx.gbl>...
You are using a reserved word "Name" as a field name. You can change your
update command so it wraps Name like this [Name] but I'd Really recommend
not using a reserved word. Chances are either your or another programmer
will forget about it in the future and you'll spend time having to track it
down.

HTH,

Bill
"bob" <pe***********@yahoo.com> wrote in message
news:90*************************@posting.google.co m...
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...
--------------------------------------------------------------------------

------


OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood

Nov 15 '05 #5
Bob:

can you show me the other names, this problem [most of the time] is a
reserved word issue or a file access problem.
"bob" <pe***********@yahoo.com> wrote in message
news:90**************************@posting.google.c om...
Thanks for the response.. I changed "name" to a more appropriate name
that is not a reserved word, but I still get the same error...

"William Ryan eMVP" <bi**@NoSp4m.devbuzz.com> wrote in message

news:<Oh**************@TK2MSFTNGP11.phx.gbl>...
You are using a reserved word "Name" as a field name. You can change your update command so it wraps Name like this [Name] but I'd Really recommend not using a reserved word. Chances are either your or another programmer will forget about it in the future and you'll spend time having to track it down.

HTH,

Bill
"bob" <pe***********@yahoo.com> wrote in message
news:90*************************@posting.google.co m...
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...

--------------------------------------------------------------------------
------


OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood

Nov 15 '05 #6
Bob:

can you show me the other names, this problem [most of the time] is a
reserved word issue or a file access problem.
"bob" <pe***********@yahoo.com> wrote in message
news:90**************************@posting.google.c om...
Thanks for the response.. I changed "name" to a more appropriate name
that is not a reserved word, but I still get the same error...

"William Ryan eMVP" <bi**@NoSp4m.devbuzz.com> wrote in message

news:<Oh**************@TK2MSFTNGP11.phx.gbl>...
You are using a reserved word "Name" as a field name. You can change your update command so it wraps Name like this [Name] but I'd Really recommend not using a reserved word. Chances are either your or another programmer will forget about it in the future and you'll spend time having to track it down.

HTH,

Bill
"bob" <pe***********@yahoo.com> wrote in message
news:90*************************@posting.google.co m...
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...

--------------------------------------------------------------------------
------


OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood

Nov 15 '05 #7
bob
Thanks for the help.. It was a combination of the "name" and a string
I setup to short in the db..

John

"William Ryan eMVP" <bi**@NoSp4m.devbuzz.com> wrote in message news:<Oh**************@TK2MSFTNGP11.phx.gbl>...
You are using a reserved word "Name" as a field name. You can change your
update command so it wraps Name like this [Name] but I'd Really recommend
not using a reserved word. Chances are either your or another programmer
will forget about it in the future and you'll spend time having to track it
down.

HTH,

Bill
"bob" <pe***********@yahoo.com> wrote in message
news:90*************************@posting.google.co m...
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...
--------------------------------------------------------------------------

------


OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood

Nov 15 '05 #8
bob
Thanks for the help.. It was a combination of the "name" and a string
I setup to short in the db..

John

"William Ryan eMVP" <bi**@NoSp4m.devbuzz.com> wrote in message news:<Oh**************@TK2MSFTNGP11.phx.gbl>...
You are using a reserved word "Name" as a field name. You can change your
update command so it wraps Name like this [Name] but I'd Really recommend
not using a reserved word. Chances are either your or another programmer
will forget about it in the future and you'll spend time having to track it
down.

HTH,

Bill
"bob" <pe***********@yahoo.com> wrote in message
news:90*************************@posting.google.co m...
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 appreciated..

Error: An unhandled exception of type
"System.Data.OleDb.OleDbException' occurred in system.data.dll

This error is from the following line:

thisAdapter.Update(thisDataSet, "tCompany");

Here's the code i'm using...
--------------------------------------------------------------------------

------


OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0 ;Data
Source=C:\devel\csharp\company\db\company.mdb");

OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM
tCompany", thisConnection);

DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "tCompany");

DataRow thisRow=thisDataSet.Tables["tCompany"].NewRow();
thisRow["name"]="some name";
thisRow["street"]="some street";
thisRow["city"]="some city";
thisRow["state"]="some state";
thisDataSet.Tables["tCompany"].Rows.Add(thisRow);

OleDbCommandBuilder thisBuilder = new
OleDbCommandBuilder(thisAdapter);
thisAdapter.Update(thisDataSet, "tCompany");

Thanks,

John Underwood

Nov 15 '05 #9

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...
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...
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...
4
by: [Yosi] | last post by:
I working with Excel file by using the OLEDB components such : OleDbConnection ,OleDbCommand. I successfuly read/update the Excel table. The problem is how can I change the color of spicific...
1
by: Brian Henry | last post by:
I have an access database, and one of the fields in the table I am inserting into has a date/time data type. What is the correct OleDb data type to insert the date and time that it is at the moment...
3
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I...
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...
3
by: asemeiks | last post by:
I'm using Access 97, Jet 4.0. the data resides on a Win 2000 domain server. Using .Net 1.1 and IIS 5.0 on a local XPPro computer I am trying connect to a Jet database on the server. If the data...
3
by: Allen | last post by:
I want to learn a little about database software. I have a nice example that uses System.Data.OleDb. I'd like to study it and extend it into something I can use. It's a vs2003 solution. ...
2
by: Miles | last post by:
I have a VB2005 application that has the need to read FoxPro 2.5 DBF/CDX files. I have the code (below) that opens the connection, but there are never any records, nor errors, reported... Can...
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: 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: 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
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
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
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...

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.