insert data into Access 2003

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 + "')");
 
J

Joe Fallon

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.
 
M

Mike

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 + "')");
 
J

Joe Fallon

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 + "')");
 
G

Guest

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 + "')");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,247
Latest member
crypto tax software1

Latest Threads

Top