PDA

View Full Version : Unable to update database when testing code locally using IIS


senthilpr_in
08-15-2003, 09:41 PM
Hi all,

I have written a piece of code to write the data from a form into a access database. The code is shown below.


<!--#include file="ADOvbs.inc"-->
<%
Dim oRS
Set oRS=Server.CreateObject("ADODB.Recordset")
oRS.Open "tblpatientdetails","DSN=patientdetails",adOpenKeyset,adLockOptimistic
oRS.AddNew
ORS.Fields("Lname")=Request.Form("lname")
ORS.Fields("Fname")=Request.Form("fname")
ORS.Fields("Minitial")=Request.Form("minitial")
ORS.Fields("Mrecno")=Request.Form("mrecno")
ORS.Fields("Age")=(CInt(Request.Form("age")))
ORS.Fields("Sex")=Request.Form("sex")
ORS.Fields("Dob")=Request.Form("dob")
ORS.Fields("Exam_date")=Request.Form("examdate")
ORS.Fields("Exam_type")=Request.Form("examtype")
ORS.Fields("Eqptmodel")=Request.Form("eqptmodel")
ORS.Fields("Reasonfordiag")=Request.Form("reasonfordiag")
ORS.Fields("Diffdiag")=Request.Form("diffdiag")
ORS.Fields("Icd9")=Request.Form("icd9")
ORS.Fields("Mjrfind")=Request.Form("mjrfind")
ORS.Fields("Mnrfind")=Request.Form("mnrfind")
ORS.Fields("Technote")=Request.Form("technote")
ORS.Fields("Qc")=Request.Form("qc")
ORS.Fields("Followup")=Request.Form("followup")
ORS.Update
oRS.close
%>

When I try to call this asp page writetodb.asp I get the following error.

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Cannot Update
Database or Object is read-only

/writetodb.asp, line 25

I see that the error may be due to access file being read only, but I double checked it. I have have no problems there. I'm testing the code on a computer running XP Professinal and I have IIS 5.1 installed. I also find that the inetpub folder is readonly and I'm unable to uncheck the readonly option.


The code works perfectly fine on a computer running Windows 2K SP 3 with IIS 5.0 installed.

Please help

Thanks

Senthil

raf
08-16-2003, 08:48 PM
I think the readonly property is the problem. What do you men with " ... I'm unable to uncheck the readonly option "

Did you migrate the app and db by copying it to and from a cd-rom ? Are the parent directory's read only ? was the db-closed when you tried to change the readonly ?

Oh yeah, anny reason why you don't use an simple insert statement instead of opening a recordset and then addign a new record to that and updating the complete recordset?