Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Cannot insert row into Access table


Message #1 by hp1431@h... on Wed, 6 Feb 2002 17:06:04
I've used ASP and MS Access for retrievals. I am now trying to understand 

how update a database, but cannot make it work. CAn anyone here help?



I'm trying out ASP ideas on a small Access 2000 database. It's in the 

personal web publishing area of my W2000 system, in the same directory as 

my asp files. 



I can read the database to display content - i.e the folowing works:



<HTML>

<HEAD>

<TITLE>Database test</TITLE> 	

    <!-- #include file="adovbs.inc" -->

    <%

    set db = server.createobject("adodb.connection")	

    db.Open "testdb"

    set booking = server.createobject("ADODB.recordset")

    booking.Open "Bookings",db,adOpenKeyset,adLockOptimistic,adCmdTable

    %>

</HEAD>

<BODY>

    Bookings database query

    <p><%=booking.Fields("Bname")%>

    <p><%=booking.Fields("Baddr")%>

</BODY>

</HTML>



But , if I change the body to insert a new row:



<BODY>

    Bookings database insert

    <%

    booking.AddNew

    booking.Fields("Bname") = "cust name"

    booking.Fields("Baddr") = "home address"

    booking.Update

    %>

</BODY>

</HTML>



I get  "page cannot be displayed" output, with the error message



    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)

    [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or 

object is read-only.



I've tried the Open statement with the VB constant names, and with the 

numerical values for the parameters. I've also tried doing it with SQL. 



Message #2 by "renee" <rculley@n...> on Thu, 7 Feb 2002 23:24:41
Hi, 



Have you checked that the .mdb file you are updating has read/write access 

for your webserver in the W2000 permissions?



Try right clicking on database file in Windows Explorer and choose 

Properties - You should have Security in there. Click that and make sure 

there is a IUSR_pcname (where pcname is your computers name) has full 

control over the .mdb.



Hope this helps

Renee :)



> I've used ASP and MS Access for retrievals. I am now trying to 

understand 

> how update a database, but cannot make it work. CAn anyone here help?

> 

> I'm trying out ASP ideas on a small Access 2000 database. It's in the 

> personal web publishing area of my W2000 system, in the same directory 

as 

> my asp files. 

> 

> I can read the database to display content - i.e the folowing works:

> 

> <HTML>

> <HEAD>

> <TITLE>Database test</TITLE> 	

>     <!-- #include file="adovbs.inc" -->

>     <%

>     set db = server.createobject("adodb.connection")	

>     db.Open "testdb"

>     set booking = server.createobject("ADODB.recordset")

>     booking.Open "Bookings",db,adOpenKeyset,adLockOptimistic,adCmdTable

>     %>

> </HEAD>

> <BODY>

>     Bookings database query

>     <p><%=booking.Fields("Bname")%>

>     <p><%=booking.Fields("Baddr")%>

> </BODY>

> </HTML>

> 

> But , if I change the body to insert a new row:

> 

> <BODY>

>     Bookings database insert

>     <%

>     booking.AddNew

>     booking.Fields("Bname") = "cust name"

>     booking.Fields("Baddr") = "home address"

>     booking.Update

>     %>

> </BODY>

> </HTML>

> 

> I get  "page cannot be displayed" output, with the error message

> 

>     Microsoft OLE DB Provider for ODBC Drivers (0x80004005)

>     [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or 

> object is read-only.

> 

> I've tried the Open statement with the VB constant names, and with the 

> numerical values for the parameters. I've also tried doing it with SQL. 

> 


  Return to Index