Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 18th, 2005, 12:19 PM
Authorized User
 
Join Date: May 2005
Location: Newark, Ohio, USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble writing database

I am a rookie trying to learn. I downloaded "Wrox Classifieds Application" from chapter 15 of the book " Beginning Active Server Pages 3.0 " I have learned a great deal from fighting this problem.

My problem occures when I try to write to the database it returns an error

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services


• Error Type:
Microsoft JET Database Engine (0x80040E09)
Cannot update. Database or object is read-only.
/AddUser.asp, line 13
• Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
• Page:
POST 120 bytes to /AddUser.asp
• POST Data:
email=h&GivenName=h&FamilyName=h&Address1=h&Addres s2=h&City=h&State=h&PostalCode=h&Country=h&Passwor d=2&VerifyPassword=2

I can open the database and write it manually. Asp can pull data from the database just can't write it with any of the asp pages from my browers.

Any ideas as to how to fix this problem?

Thanks

Mike Drumm


 
Old May 18th, 2005, 01:08 PM
Authorized User
 
Join Date: May 2005
Location: Newark, Ohio, USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm sorry I forgot to include the code that I have been struggling with in my earlier post. This is downloaded directly from Wrox but I can't get it to write the database. Any help would be appreciated.













<%
  Dim rsUsers
  Set rsUsers = Server.CreateObject("ADODB.Recordset")
  rsUsers.Open "Person", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable

  If Session("PersonID") <> "" Then ' currently logged-on user
    rsUsers.Filter = "PersonID = '" & Session("PersonID") & "'"
  Else ' New session
    rsUsers.Filter = "EMailAddress = '" & Request.Form("email") & "'" & _
                     "AND Password = '" & Request.Form("password") & "'"
    If rsUsers.EOF Then ' User not found
      rsUsers.AddNew ' ...so add a new record
' Else
' Email address and password matched with DB records -
' In this case we'll allow this to update user's personal details
    End If
  End If
                                                  ' write personal details to record
  rsUsers("EMailAddress") = Request.Form("email")
  rsUsers("Password") = Request.Form("password")
  rsUsers("FamilyName") = Request.Form("FamilyName")
  rsUsers("GivenName") = Request.Form("GivenName")
  rsUsers("StreetAddress1") = Request.Form("Address1")
  rsUsers("StreetAddress2") = Request.Form("Address2")
  rsUsers("City") = Request.Form("City")
  rsUsers("State") = Request.Form("State")
  rsUsers("PostalCode") = Request.Form("PostalCode")
  rsUsers("Country") = Request.Form("Country")
  rsUsers("Active") = True
  rsUsers("LastLogin") = Now
  rsUsers.Update ' update the database

  Dim strName, strValue ' create session variables
  For each strField in rsUsers.Fields
    strName = strField.Name
    strValue = strField.value
    Session(strName) = strValue
  Next
  Session("blnValidUser") = True ' declare that current user is validated
  Response.Redirect "MenuForRegisteredUsers.asp"
%>




<!-- METADATA TYPE="typelib"
              FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
  Dim objConn
  Set objConn = Server.CreateObject("ADODB.Connection")
  objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
               "Data Source= c:\Inetpub\WWWRoot\BegASPFiles\classified.mdb"

  If Session("blnValidUser") = True and Session("PersonID") = "" Then
    Dim rsPersonIDCheck
    Set rsPersonIDCheck = Server.CreateObject("ADODB.Recordset")
    Dim strSQL
    strSQL = "SELECT PersonID FROM Person " & _
             "WHERE EMailAddress = '" & Session("EMailAddress") & "';"
    rsPersonIDCheck.Open strSQL, objConn
    If rsPersonIDCheck.EOF Then
      Session("blnValidUser") = False
    Else
      Session("PersonID") = rsPersonIDCheck("PersonID")
    End If
    rsPersonIDCheck.Close
    Set rsPersonIDCheck = Nothing
  End If
%>


 
Old May 19th, 2005, 02:16 AM
Authorized User
 
Join Date: May 2005
Location: Beringe, , Netherlands.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

did you give the database correct rights for users? so writing users for the IIS user?
Earlier i also coudn't write into my database from an ASP.NET page and when i give it rights for those users
it was possible!

--------------------------------------------------
"Want more trouble in you're life?? Buy a PC"
 
Old May 19th, 2005, 07:28 AM
Authorized User
 
Join Date: Jul 2004
Location: Hyderabad, Andhra Pradesh, India.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to raj_makro
Default

Try this
  Right click on the folder containing the database, choose properties and select security tab. Click on add, select the user, iusr_machinename and add it. Click ok and assign full control permission to this user. Click ok. Then try your applicaion. (Note: This procedure works only if the drive is NTFS formatted)

Regards
Raj
 
Old August 4th, 2005, 02:50 PM
Registered User
 
Join Date: Aug 2005
Location: Saint Paul, MN, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am experiencing the same problem with trying to write to or update the databases in the Beginning ASP textbook. I keep getting error indicating the databases are read only. I have checked properties, security, read/write permissions, etc. and cannot find anything that indicates Read Only. Has anyone resolved these issues?

 
Old August 4th, 2005, 03:27 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Maybe this FAQ can shed some light?? http://imar.spaanjaars.com/QuickDocId.aspx?QUICKDOC=263

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Undone - The Sweater Song (weezer cover) by Sonic Youth (From the album: Various) What's This?




Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble writing to an Access Database JAdkins Classic ASP Basics 5 June 27th, 2007 03:05 PM
Writing to Database Scripts82 ASP.NET 1.0 and 1.1 Professional 8 September 15th, 2006 07:47 AM
Trouble writing small app... ???API usage??? kaanuki Visual C++ 0 March 13th, 2006 07:53 AM
Writing to Database - Please Help Dwizz VB.NET 2002/2003 Basics 12 May 11th, 2005 08:37 AM
writing to a database charliejamesuk MySQL 1 March 25th, 2004 11:10 AM





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