Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old January 16th, 2009, 06:10 PM
Registered User
Join Date: Jan 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default difficulty updating my access database with asp

...Help i cant update or insert data to my access data base using ASP but i can only retrieve data from access

Technical Information (for support personnel)
Error Type:
Microsoft JET Database Engine (0x80040E09)
Cannot update. Database or object is read-only.
/begasp/bbAddUser.asp, line 17.....

The line 17 of bbAddUser.asp is......[code]rsUsers.AddNew[ /code ]
the full program bbAddUser.asp is below

<!-- #include file="bb.asp" -->
  Dim rsUsers 
  Set rsUsers = Server.CreateObject ("ADODB.Recordset")
  rsUsers.Open "Members", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable     'basically to select(retrieve/filter)-adOpenForwardOnly from database, and add data to database- adLockOptimistic
 If Session("MemberID") <> "" Then                            'if session is not empty .someone is currently using the system.
 rsUsers.Filter = "MemberID = ' " & Session("MemberID") & " ' "
 rsUsers.Filter = "EMailAddress = ' " & Request.Form("email") & " ' AND Password = ' " & Request.Form("Password") & " ' "     'search for e-mail  password in database
                                                                                                                         'to determne if user is new or registered
     If rsUsers.EOF Then                                          'if false or   user not found ;he is new
 rsUsers.AddNew                                             'line 17
 'Email address and Password matched with DB records  -
 'In this case we ll allow this to update users personal details
    End If                                                         'this is loop if..else in anoda if..else
End If
                                                            'Now write personal detail to record set
rsUsers("EmailAddress") = Request.Form("email")
rsUsers("Password") = Request.Form("Password")
'rsUsers("FamilyName") = Request.Form("FamilyName")
rsUsers("GivenName") = Request.Form("GivenName")
'rsUsers("Phone") = Request.Form("Phone")
'rsUsers("PinID") = Request.Form("Pin")
'rsUsers("StreetAddress1") = Request.Form("Address1")
'rsUsers("StreetAddress2") = Request.Form("Address2")
'rsUsers("City") = Request.Form("City")
'rsUsers("State") = Request.Form("State")
'rsUsers("Country") = Request.Form("Country")
'rsUsers("Active") = True
'rsUsers("LastLogin") =  Now
'strSQL = "INSERT INTO Members (FamilyName,GivenName,EmailAddress,Password) VALUES ('rsUsers("FamilyName")','rsUsers("GivenName")','rsUsers("EmailAddress")','rsUsers("Password")')"   
rsUsers.Update                   'update the database
Dim StrName, StrValue
For each strField in rsUsers.Fields
 strName = strField.Name
 strValue = strField.Value
 Session(strName) = strValue
  Session("blnValidUser") = True
  Response.Redirect "bbMenuForRegisteredUsers.asp"

the bb.asp is the program to connect to my database
<!-- #include file="bb.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:\datastore\Bb.mdb"  '"Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\datastore\Bbfoundation2009.mdb"  ' "DSN=bbf"        '
  If Session("blnValidUser") = True and Session("MemberID") = "" Then
  Dim rsMemberIDCheck
  Set rsMemberIDCheck = Server.CreateObject("ADODB.Recordset")
  Dim strSQL
  strSQL = "SELECT MemberID FROM Members" & _  
            "WHERE EMailAddress = ' " & Session("EMailAddress") & " ' ; "
  rsMemberIDCheck.Open strSQL, objConn
  If  rsMemberIDCheck.EOF Then
  Session("blnValidUser")= False
  Session("MemberID") = rsMemberIDCheck("MemberID")
  End If
  Set rsMemberIDCheck = Nothing
  End If
thank you very much for looking into my program
  #2 (permalink)  
Old January 17th, 2009, 02:53 AM
Friend of Wrox
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

First of all, fix your browser.
-- Click on the TOOLS menu
-- Click on INTERNET OPTIONS menu item
-- Click on ADVANCED tab
-- *UN*check "Show friendly HTTP error messages"
-- OK

Now you'll get both your own debug output and more usable error messages.

But the root problem here has nothing at all to do with your code.

Quite simply, your database file (e.g., your ".mdb" file) is *NOT* writable by the IIS web server. *YOU* may have given YOURSELF permission to write into that directory and file, but you didn't give the web server permission to do so. The web server will be running as (I believe, with ASP) "IWAM_xxxx" where "xxxx" is the name of the computer it is on. (With non-.NET ASP, the web server is "IUSR_xxxx" ... I don't think that's relevant here, but...) So...you need to give the right permissions in that directory *AND* to that file.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating a gridview control w/access database p3aul ASP.NET 1.0 and 1.1 Professional 0 October 2nd, 2007 07:14 PM
Problem Updating MS Access database javlet Java Databases 1 April 24th, 2007 08:16 AM
Difficulty writing javascript to access dom ldoyle Javascript How-To 2 February 23rd, 2007 11:25 AM
updating yes/no field in MS Access database enigma82 Classic ASP Databases 2 May 6th, 2005 12:04 PM
Updating from no access database penta Access 12 October 27th, 2004 06:06 AM

All times are GMT -4. The time now is 01:37 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.