insert data into Access 2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have asp.net web app (C#) where i'm trying to insert data into a table and
i'm gettng the following error. I'm not updating anything i'm trying to
insert via my SQL.

The following error has occured ERROR [HY000] [Microsoft][ODBC Microsoft
Access Driver] Operation must use an updateable query

here is my SQL
string addSQL = ("INSERT INTO carBuilder(empID, startTIme, EndTime, Make,
Model, notes) " +
"VALUES(" + "'" + empID + "', " + "'" + startTime.Text + "', " + "'"
+EndTime.Text + "', " + "'" + Make.Text + "', " + "'" +
ddModel.SelectedItem.Text + "', " + "'" + Notes.Text + "')");
 
That error usually means you have a typo.

I suggest you set a break point here and grab the value of your SQL string
and then try to execute it directly inside Access.

It should fail there too but then you can find and fix the error then
update your code.

string addSQL = ("INSERT INTO carBuilder(empID, startTIme, EndTime, Make,
Model, notes) " +
"VALUES(" + "'" + empID + "', " + "'" + startTime.Text + "', " + "'"
+EndTime.Text + "', " + "'" + Make.Text + "', " + "'" +
ddModel.SelectedItem.Text + "', " + "'" + Notes.Text + "')");

1. How can addSQL be a string and yet the first character is (
2. Same for the last character.
3. In Access, the command to insert dates uses # not ' when wrapping the
date string.
 
all the values are being passed correctly but now its telling me the query
needs to be updateable.


Joe Fallon said:
That error usually means you have a typo.

I suggest you set a break point here and grab the value of your SQL string
and then try to execute it directly inside Access.

It should fail there too but then you can find and fix the error then
update your code.

string addSQL = ("INSERT INTO carBuilder(empID, startTIme, EndTime, Make,
Model, notes) " +
"VALUES(" + "'" + empID + "', " + "'" + startTime.Text + "', " + "'"
+EndTime.Text + "', " + "'" + Make.Text + "', " + "'" +
ddModel.SelectedItem.Text + "', " + "'" + Notes.Text + "')");

1. How can addSQL be a string and yet the first character is (
2. Same for the last character.
3. In Access, the command to insert dates uses # not ' when wrapping the
date string.
--
Joe Fallon




Mike said:
I have asp.net web app (C#) where i'm trying to insert data into a table
and
i'm gettng the following error. I'm not updating anything i'm trying to
insert via my SQL.

The following error has occured ERROR [HY000] [Microsoft][ODBC Microsoft
Access Driver] Operation must use an updateable query

here is my SQL
string addSQL = ("INSERT INTO carBuilder(empID, startTIme, EndTime, Make,
Model, notes) " +
"VALUES(" + "'" + empID + "', " + "'" + startTime.Text + "', " + "'"
+EndTime.Text + "', " + "'" + Make.Text + "', " + "'" +
ddModel.SelectedItem.Text + "', " + "'" + Notes.Text + "')");
 
Please post the string output so we can all read the command.
--
Joe Fallon



Mike said:
all the values are being passed correctly but now its telling me the query
needs to be updateable.


Joe Fallon said:
That error usually means you have a typo.

I suggest you set a break point here and grab the value of your SQL
string and then try to execute it directly inside Access.

It should fail there too but then you can find and fix the error then
update your code.

string addSQL = ("INSERT INTO carBuilder(empID, startTIme, EndTime, Make,
Model, notes) " +
"VALUES(" + "'" + empID + "', " + "'" + startTime.Text + "', " + "'"
+EndTime.Text + "', " + "'" + Make.Text + "', " + "'" +
ddModel.SelectedItem.Text + "', " + "'" + Notes.Text + "')");

1. How can addSQL be a string and yet the first character is (
2. Same for the last character.
3. In Access, the command to insert dates uses # not ' when wrapping the
date string.
--
Joe Fallon




Mike said:
I have asp.net web app (C#) where i'm trying to insert data into a table
and
i'm gettng the following error. I'm not updating anything i'm trying to
insert via my SQL.

The following error has occured ERROR [HY000] [Microsoft][ODBC Microsoft
Access Driver] Operation must use an updateable query

here is my SQL
string addSQL = ("INSERT INTO carBuilder(empID, startTIme, EndTime,
Make,
Model, notes) " +
"VALUES(" + "'" + empID + "', " + "'" + startTime.Text + "', " + "'"
+EndTime.Text + "', " + "'" + Make.Text + "', " + "'" +
ddModel.SelectedItem.Text + "', " + "'" + Notes.Text + "')");
 
Mike the Error is a Permission issue!!
MAke sure u have Write And at least read access on the Directory and on the
FILE i.e the MS ACCESS file which is .mdb file..
Hope it helps!!
Enjoy
Patrick

Mike said:
all the values are being passed correctly but now its telling me the query
needs to be updateable.


Joe Fallon said:
That error usually means you have a typo.

I suggest you set a break point here and grab the value of your SQL string
and then try to execute it directly inside Access.

It should fail there too but then you can find and fix the error then
update your code.

string addSQL = ("INSERT INTO carBuilder(empID, startTIme, EndTime, Make,
Model, notes) " +
"VALUES(" + "'" + empID + "', " + "'" + startTime.Text + "', " + "'"
+EndTime.Text + "', " + "'" + Make.Text + "', " + "'" +
ddModel.SelectedItem.Text + "', " + "'" + Notes.Text + "')");

1. How can addSQL be a string and yet the first character is (
2. Same for the last character.
3. In Access, the command to insert dates uses # not ' when wrapping the
date string.
--
Joe Fallon




Mike said:
I have asp.net web app (C#) where i'm trying to insert data into a table
and
i'm gettng the following error. I'm not updating anything i'm trying to
insert via my SQL.

The following error has occured ERROR [HY000] [Microsoft][ODBC Microsoft
Access Driver] Operation must use an updateable query

here is my SQL
string addSQL = ("INSERT INTO carBuilder(empID, startTIme, EndTime, Make,
Model, notes) " +
"VALUES(" + "'" + empID + "', " + "'" + startTime.Text + "', " + "'"
+EndTime.Text + "', " + "'" + Make.Text + "', " + "'" +
ddModel.SelectedItem.Text + "', " + "'" + Notes.Text + "')");
 
Back
Top