Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2004, 08:21 PM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Insert new Record

Why am I getting this?

Error Type:
Microsoft JET Database Engine (0x80040E09)
Cannot update. Database or object is read-only.
/addxxxxxxxxx.asp, line 24

Line 24 of my code reads
objRS.AddNew

*********************Start code********************
<%
  Option Explicit
'Database connection
  Dim strConnect
%>



<%
  Dim objRS, 11111, 222222, 333333, 444444, 555555, 666666
          11111 = Request.Form("firstrecord")
          222222 = Request.Form("secondrecord")
         333333 = Request.Form("thirdrecord")
        444444 = Request.Form("forthrecord")
          555555 = Request.Form("fifthrecord")
         666666 = Request.Form("sixthrecord")
  Set objRS = Server.CreateObject ("ADODB.Recordset")
  objRS.Open "the database", strConnect, adOpenStatic, adLockOptimistic, adCmdTable


 objRS.MoveLast



      objRS.AddNew ' This line seems to be a problem
      objRS("table1") = 11111
      objRS("table2") = 222222
      objRS("table3") = 333333
      objRS("table4") = 444444
      objRS("table5") = 555555
      objRS("table6") = 666666

' Updating the database

      objRS.Update
      objRS.Close

  If objRS.EOF Then
    Response.Write "No Record added try again."
  Else
    Response.Write "Record has been added. Your the man!"
      End If

  objRS.Close
  Set objRS = Nothing
%>

*********************END code********************
 
Old September 5th, 2004, 09:55 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

  You check the permission on the database whether you can write/update/delete.



 
Old September 6th, 2004, 12:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

1) Check if the .mdb file is read only. (right click the file and choose properties, uncheck if READONLY is checked)

2) Check if write permissions on .mdb file is given for the Internet Guest account (IUSR_MACHINE).

NOTE: When using Microsoft Access databases with ADO, it is also necessary to give the Internet Guest account Write permissions on the directory containing the .mdb file. This is because Jet creates an .ldb file to handle database locking. You may also need to give read/write permission on the "Temp" folder because Jet may create temporary files in this directory.

3) Check if you are opening the connection and database with proper mode for updating.

I assume the the database, in the below statement refers to the TableName.
Code:
objRS.Open "the database", strConnect, adOpenStatic, adLockOptimistic, adCmdTable
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert where record doesn't already exist Neal SQL Server 2000 3 February 4th, 2008 10:09 AM
how Insert record into two tables mfarooqw ASP.NET 1.0 and 1.1 Basics 2 July 10th, 2007 05:38 PM
INSERT and get the record back? tal ADO.NET 1 June 29th, 2007 08:30 AM
Insert record disabled jking Access 9 January 10th, 2006 04:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.