By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,191 Members | 2,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,191 IT Pros & Developers. It's quick & easy.

OleDb Question

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.