microsoft access and the updateable query error

  • Thread starter Thread starter elan
  • Start date Start date
E

elan

hi all,

I really need some help here. I'm using an Access database with a web
application and I keep getting the operation must use an updateable query
error. The mdb file and directory is given full permission to everyone, the
queries causing this error are straight forward insert or update queries.
I've searched around, saw a lot of people asking, but not really any
answers. I'd really appreciate any help I can get. Some things I noticed
after this error occured: When I try to open the database in Access, it
says that the database is read-only. When I try delete the database file, it
says there's a sharing violation. It seems that only rebooting will fix the
database. Here's the code snippet that causes the error:

string dbCommandStr = "INSERT INTO `category`( name, thumbnail, parent )
VALUES( '" + catName.Value + "', '" + Path.GetFileName(
File1.PostedFile.FileName ) + "', " + Request.Form["catList"] + " )";

string dbConnectionStr = "Provider=Microsoft.JET.OLEDB.4.0; Data Source=" +
myConfig.dbPath;

OleDbConnection dbConnection = new OleDbConnection(dbConnectionStr);

OleDbCommand insertCommand = new OleDbCommand( dbCommandStr, dbConnection );

insertCommand.Connection.Open();

insertCommand.ExecuteNonQuery();

dbConnection.Close();

Server.Transfer("default.aspx");


thanks
Eric Lan
 
¤ hi all,
¤
¤ I really need some help here. I'm using an Access database with a web
¤ application and I keep getting the operation must use an updateable query
¤ error. The mdb file and directory is given full permission to everyone, the
¤ queries causing this error are straight forward insert or update queries.
¤ I've searched around, saw a lot of people asking, but not really any
¤ answers. I'd really appreciate any help I can get. Some things I noticed
¤ after this error occured: When I try to open the database in Access, it
¤ says that the database is read-only. When I try delete the database file, it
¤ says there's a sharing violation. It seems that only rebooting will fix the
¤ database. Here's the code snippet that causes the error:
¤
¤ string dbCommandStr = "INSERT INTO `category`( name, thumbnail, parent )
¤ VALUES( '" + catName.Value + "', '" + Path.GetFileName(
¤ File1.PostedFile.FileName ) + "', " + Request.Form["catList"] + " )";
¤
¤ string dbConnectionStr = "Provider=Microsoft.JET.OLEDB.4.0; Data Source=" +
¤ myConfig.dbPath;
¤
¤ OleDbConnection dbConnection = new OleDbConnection(dbConnectionStr);
¤
¤ OleDbCommand insertCommand = new OleDbCommand( dbCommandStr, dbConnection );
¤
¤ insertCommand.Connection.Open();
¤
¤ insertCommand.ExecuteNonQuery();
¤
¤ dbConnection.Close();
¤
¤ Server.Transfer("default.aspx");

Have you looked at the following MS KB article:

PRB: Cannot Connect to Access Database from ASP.NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;316675&Product=aspnet


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Paul Clement said:
¤ hi all,
¤
¤ I really need some help here. I'm using an Access database with a web
¤ application and I keep getting the operation must use an updateable query
¤ error. The mdb file and directory is given full permission to everyone, the
¤ queries causing this error are straight forward insert or update queries.
¤ I've searched around, saw a lot of people asking, but not really any
¤ answers. I'd really appreciate any help I can get. Some things I noticed
¤ after this error occured: When I try to open the database in Access, it
¤ says that the database is read-only. When I try delete the database file, it
¤ says there's a sharing violation. It seems that only rebooting will fix the
¤ database. Here's the code snippet that causes the error:
¤
¤ string dbCommandStr = "INSERT INTO `category`( name, thumbnail, parent )
¤ VALUES( '" + catName.Value + "', '" + Path.GetFileName(
¤ File1.PostedFile.FileName ) + "', " + Request.Form["catList"] + " )";
¤
¤ string dbConnectionStr = "Provider=Microsoft.JET.OLEDB.4.0; Data Source=" +
¤ myConfig.dbPath;
¤
¤ OleDbConnection dbConnection = new OleDbConnection(dbConnectionStr);
¤
¤ OleDbCommand insertCommand = new OleDbCommand( dbCommandStr, dbConnection );
¤
¤ insertCommand.Connection.Open();
¤
¤ insertCommand.ExecuteNonQuery();
¤
¤ dbConnection.Close();
¤
¤ Server.Transfer("default.aspx");

Have you looked at the following MS KB article:

PRB: Cannot Connect to Access Database from ASP.NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;316675&Product=aspnet


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)

that was exactly the problem. thanks a lot.
 
Back
Top