Can't insert data to MS Access 2003

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

Guest

Hi,

I have a C# application with MS access 2003 as DB for password protection.
The DB has two tables: one is Logins, the other Visits.

When I do the reading as below:
SELECT Password FROM Logins WHERE Username ='dale'

it is a success.
INSERT INTO Visits (Email,LoginDate,ReferPage,LoginOK,LoginPass,IP) VALUES
('dale',#8/13/2005 11:46:41
AM#,'/passwordProtectCSharp/privatePage.aspx',1,'dale1','127.0.0.1')

it always gives me an exception as below:
Operation must use an updatable query.

The codes are:
try
{
// write the visit log entry
dbConn = new OleDbConnection(sConn);
dbConn.Open();
dbCmd = new OleDbCommand(sSQL, dbConn);
dbCmd.ExecuteNonQuery();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
when I write the DB as below:

I want to run the "insert" in MS access separately for testing, can not find
a way to do so. Any suggestions are welcome. -Dale
 
Do you have write permissions on the folder? Is the database file read
only?

These are the two most likely reasons you are getting this error.
Particularly
if you are running this via an ASP.NET application because the http
request is not run under your windows account by default.

--
Robbe Morris - 2004/2005 Microsoft MVP C#

Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp
 
thank you for the suggestions. The 1st 2 questions are not the case.

I am using asp.net. this does ring my bell. when i learnt .net, we used sql
DB. I recall we needed to add some writeable options in sql manager.

But I am using MS access now, how do I add writeable options?

-Dale
 
The link posted from the other guy dealt with classic ASP but is
still applicable. Check to see which windows account your ASP.NET
accounts are running under and make sure that folder and the database
file itself have write permissions. They are probably being handled
by the "Network Service" windows account.

--
Robbe Morris - 2004/2005 Microsoft MVP C#

Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp
 
Back
Top