The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ASP Programming
|
Cannot Add/Update Access database
Discuss Cannot Add/Update Access database in the ASP Programming forum on Dev Shed. Cannot Add/Update Access database ASP Programming forum discussing Active Server Pages coding techniques and problem solving methods. Use VBScript or Jscript to make dynamic web applications.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 16th, 2003, 11:24 PM
|
|
Junior Member
|
|
Join Date: Nov 2003
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Cannot Add/Update Access database
I got problem to insert or update new record into the Access database. For your information, I run my ASP program on Win XP Professional SP1(service pack 1)with IIS 5.1 and ASP.NET v1.1. I''m using Access database version 2002.
I can read the database file, but can''t add new record to it although I was set the folder which database files reside to permissioan access to be write in IIS. My ASP program(program to add new record with ASP) work fine with other pc but got an errors with my pc.
The errors stated in my web browser as below:-
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)
Error Type:
Microsoft JET Database Engine (0x80040E09)
Cannot update. Database or object is read-only.
/testinsertasp.asp, line 77
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
This is my ASP program to insert new record into the Access database:-
<!--METADATA TYPE="typelib" FILE="c:\program files\common files\system\ado\msado15.dll"-->
<%
Option Explicit
Call Main
Sub Main
if request("a") = "v" Then
Call AddRecord
else
Call Showform
end if
End Sub
Sub Showform
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body>
<form name="form1" method="post" action="<%=request("script_name")%>?a=v">
<div id="Layer1" style="position:absolute; left:156px; top:64px; width:88px; height:20px; z-index:1">Name</div>
<div id="Layer2" style="position:absolute; left:281px; top:57px; width:236px; height:23px; z-index:2">
<input name="txtname" type="text" id="txtname">
</div>
<div id="Layer3" style="position:absolute; left:151px; top:108px; width:101px; height:19px; z-index:3">IC</div>
<div id="Layer4" style="position:absolute; left:280px; top:107px; width:234px; height:19px; z-index:4">
<input name="txtic" type="text" id="txtic">
test new</div>
<div id="Layer5" style="position:absolute; left:149px; top:153px; width:102px; height:15px; z-index:5">Address</div>
<div id="Layer6" style="position:absolute; left:280px; top:145px; width:234px; height:22px; z-index:6">
<textarea name="txtadd" id="txtadd"></textarea>
</div>
<div id="Layer7" style="position:absolute; left:282px; top:243px; width:56px; height:26px; z-index:7">
<input type="submit" name="Submit" value="Submit">
</div>
<div id="Layer8" style="position:absolute; left:377px; top:244px; width:67px; height:23px; z-index:8">
<input type="submit" name="Submit2" value="Clear">
</div>
</form>
</body>
</html>
<% End Sub %>
<% Sub AddRecord
Dim rs,conn,strname,stric,stradd
Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " & server.MapPath("database/test.mdb")
conn.Open
strname = trim(request.form("txtname"))
stric = trim(request.form("txtic"))
stradd = trim(request.form("txtadd"))
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM tblPersonal", conn, adOpenDynamic, adLockOptimistic
'On error resume next
rs.Addnew
rs("Name") = strname
rs("IC") = stric
rs("Add") = stradd
rs.Update
rs.Movelast
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
'if err <> 0 Then
'Response.write "Data fail to be write"
'else
'Response.write "Success"
'end if
End Sub %>
I think maybe got some problem with my IIS 5.1, ASP.NET v1.1 and Win XP Professional.
Your help is much appreciated.
Thank you.
|

December 17th, 2003, 03:24 PM
|
|
|
|
Moved to ASP from the IIS forum
|

January 7th, 2004, 01:19 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 14
Time spent in forums: 1 h 20 m 11 sec
Reputation Power: 0
|
|
|
I am having the exact same problem.
I am using XP Pro, Access 2003, ASP, IIS 5.1 on Personal Web Server with file type of NTFS.
I adjusted the database in IIS management to Write. When I go to the folder in Windows Exploder to adjust the folder to Write, when I apply and get out, I go back to the properties and the folder is Read again.
This is the error message I am getting in ASP:
Error Type:
Microsoft JET Database Engine (0x80040E09)
Cannot update. Database or object is read-only.
/TestSite/ValidateLogin.asp, line 59
Any help would be very appreciated.
|

January 7th, 2004, 04:20 PM
|
|
|
|
Is the MDB file marked as "read-only"?
|

January 7th, 2004, 05:29 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 14
Time spent in forums: 1 h 20 m 11 sec
Reputation Power: 0
|
|
|
No, the database itself is not marked as "Read-only".
However, the folder 'databases' seems to remain 'Read-only', everytime I change that folder to Write, after I 'Apply' and 'OK'. If I check the properties again, it has a slight green box on "Read-only" not a check???
???
Thanks.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|