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 May 2nd, 2008, 08:38 AM
Registered User
Join Date: Apr 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to zedekiah
Default Cannot update. Database or object is read-only.

please some one enlighten me about this issue when i'm trying to add
new data to the database i got the above arror msg

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

  Dim strDatabaseType

  'Choose one of the following two lines, and comment out the other
  strDatabaseType = "Access"
  'strDatabaseType = "MSDE"

  'Now we use this selection to specify the connection string
  If strDatabaseType = "Access" Then
    strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                 "Data Source=D:\Inetpub\wwwroot\Movie2000.mdb;" & _
                 "Persist Security Info=False"
    strConnect = "Provider=SQLOLEDB;Persist Security Info=False;" & _
                 "User ID=sa;Initial Catalog=Movie;" & _
                 "Initial File Name=C:\MSSQL7\Data\Movie2000.mdf"
                  End If

  Option Explicit
  Dim strConnect

<!-- METADATA TYPE="typelib"
              FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<TITLE>Adding a New Record</TITLE>
  Dim objRS, intIDForNewRecord
  Set objRS = Server.CreateObject ("ADODB.Recordset")
  objRS.Open "Movies", strConnect, adOpenStatic, adLockOptimistic, adCmdTable

  intIDForNewRecord = objRS("MovieID") + 1

  objRS.AddNew ' add a new record
  objRS("MovieID") = intIDForNewRecord
  objRS("Title") = "Psycho"

  objRS.Open "SELECT * FROM Movies WHERE MovieID=" & intIDForNewRecord, _
                   strConnect, adOpenForwardOnly, adLockReadOnly, adCmdText
  If objRS.EOF Then
    Response.Write "New record not found - something went wrong"
    Response.Write "You've successfully added a new record:<BR> " & _
                   "Movie title = '" & objRS("Title") & "'<BR>" & _
                   "MovieID = " & objRS("MovieID")
  End If

  objRS.Close ' now close and clean up
  Set objRS = Nothing

Old May 2nd, 2008, 09:30 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

This is usually a permissions issue:


Imar Spaanjaars
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database or object is read-only ryanb Access ASP 25 January 17th, 2014 06:36 PM
Update Fails - Database is Read-Only pete robinson Classic ASP Basics 3 December 19th, 2007 02:40 PM
Read and update/increment XML doc from aspx Hughesie78 XML 7 December 13th, 2007 06:18 AM
How to read and update .INI files using Pure C ?? Poonam C++ Programming 1 March 24th, 2005 01:22 AM
Read only Database error larry101 Classic ASP Databases 4 September 11th, 2004 08:41 AM

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