Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating an access 97 record with asp

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am trying to update a record that will show how many times a user has logged into a page. Access is giving me the folowing error when I try to update the record.

Microsoft JET Database Engine error '80040e09'

Cannot update. Database or object is read-only.

/DD.asp, line 27


Here is the Code:
IF Request.Form("login") = "login" then
dim rsLogin
dim cnLogin
dim rsPassword
dim rsUpdate
set cnLogin= server.CreateObject("ADODB.Connection")
cnLogin.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\set rsLogin = Server.CreateObject("ADODB.Recordset")
set rsPassword = Server.CreateObject("ADODB.Recordset")
rsLogin.Open "Select * From [User] Where User.UserName='" & Request.Form("txtUserName")&"'",cnLogin,2,3
IF rsLogin.EOF AND rsLogin.BOF then
Response.Redirect("DD.asp?ErrorType=User")
ELSE
rsPassword.Open "Select * From [Password] Where Password.UserRole=" & rsLogin("UserRole"),cnLogin
IF trim(lcase(rsPassword(&quot;Password&quot;)))<> trim(lcase(Request.Form(&quot;Password&quot;))) then
Response.Redirect(&quot;DD.asp?ErrorType=Password&quot;)
ELSE
session(&quot;loggedin&quot;) = &quot;true&quot;
set rsUpdate = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsUpdate.Open &quot;Select * FROM [User] Where UserName='&quot;& Request.Form(&quot;txtUserName&quot;)&&quot;'&quot;, cnLogin,2,3
if not rsUpdate.EOF then
rsUpdate(&quot;NumberLogins&quot;) = rsLogin(&quot;NumberLogins&quot;) + 1
rsUpdate.Update '*Here is the line the error is on
end if
END IF
END IF
 
It is possible that the Access Database truly IS read-only. It happened to me when I copied the database up to my server using Visual Interdev. The file was flagged as read-only.

I simply changed the file properties and the script worked. =====================
Dennis B
 
Sorry but DennistheMenace was correct.
I had already tried doing an update sql statement. It was a permissions setting on the file.I changed it from read only and the exact code above worked perfectly.

Thanks Dennis

Thanks for your help also TechnicalAnalysis.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top