MS Access trouble

W

Wessam Bahnassi

Greetings,

I'm trying to insert values into an MDB with ASP.NET 1.1, and the OleDb Jet
4 provider.
However, whenever I issue and INSERT INTO statement I get the exception:
"Operation must use an updateable query."

This is my code:

string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
connString += Server.MapPath("db\\records.mdb");
connString += ";"
OleDbConnection connection = new OleDbConnection(connString);
connection.Open();

OleDbCommand dbCmd = new OleDbCommand("INSERT INTO DSKSB_Demos ",conn);
dbCmd.CommandText += "(Platform,Company,Title) VALUES (win32,sci,mr)";
dbCmd.ExecuteNonQuery(); // Exception...
conn.Close();

If I only read data then no errors occur. The MDB file is not set to
Read-only.
It's a normal file put in c:\inetpub\wwwroot\mysite\db

How can I overcome this exception?
Thanks for any help...
 
J

Juan T. Llibre

Give the ASP.NET account read/write/change permissions
over the c:\inetpub\wwwroot\mysite\db\ directory.
 
W

Wessam Bahnassi

Sorry if it is too obvious, but how do you grant the ASP.NET account these
permissions?

Thanks a lot!
 
R

Rob Schieber

Wessam said:
Greetings,

I'm trying to insert values into an MDB with ASP.NET 1.1, and the OleDb Jet
4 provider.
However, whenever I issue and INSERT INTO statement I get the exception:
"Operation must use an updateable query."

This is my code:

string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
connString += Server.MapPath("db\\records.mdb");
connString += ";"
OleDbConnection connection = new OleDbConnection(connString);
connection.Open();

OleDbCommand dbCmd = new OleDbCommand("INSERT INTO DSKSB_Demos ",conn);
dbCmd.CommandText += "(Platform,Company,Title) VALUES (win32,sci,mr)";
dbCmd.ExecuteNonQuery(); // Exception...
conn.Close();

If I only read data then no errors occur. The MDB file is not set to
Read-only.
It's a normal file put in c:\inetpub\wwwroot\mysite\db

How can I overcome this exception?
Thanks for any help...
Wessam,

I think you need tick marks around your string literals:
(win32,sci,mr) should be ('win32','sci','mr')
 
W

Will Chamberlain

Right-click on the folder containing the database and change the
security settings to read, write, modify, or whatever combination you
need to complete the task.
 
J

Juan T. Llibre

From within Windows Explorer, right-click the directory
and select the "Properties" link; then select the "Security" tab.

If you don't see a "Security" tab, you might be running FAT32
( hopefully not... ) and you might need to convert your file system
to NTFS.

FAT32 file systems don't allow setting ACLs.
 
W

Wessam Bahnassi

Thanks to all of ya guys. No I'm running NTFS, and I setup the permissions
and everything is now running file...

Thanks again :)
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top