If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Cant update Access DB using ASP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-04, 17:03
borisrisker borisrisker is offline
Registered User
 
Join Date: Jul 2003
Posts: 8
Angry Cant update Access DB using ASP

Hi Everybody,

I have a problem: when i want to use the rs.update method in ASP, i get the following error:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Update not possible; Database or Object ist write protected.
/hcb/anmelden_response.asp, line 42

can somebody help me ? (I am using Windows XP)


the code:

---- CODE START ----

<%

'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rs 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

adoCon.Mode = 3
'adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/db/hcb.mdb")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/db/HCB.mdb")
'adoCon.Open "DSN=HCB"

'Create an ADO recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "Web_Formular"

'Set the cursor type we are using so we can navigate through the recordset
rs.CursorType = 2 '2

'Set the lock type so that the record is locked by ADO when it is updated
rs.LockType = 3 '3

'Open the recordset with the SQL query
rs.Open strSQL, adoCon

'Tell the recordset we are adding a new record to it
rs.AddNew

'Response.Write rs("Vorname")
'Response.Write rs("Nachname")

rs("Vorname") = Request.Form("VNAME")
rs("Nachname") = Request.Form("NNAME")
'rs.fields("Datum_Erfassung")=now

'Write the updated recordset to the database
rs.Update

'Reset server objects
rs.Close
Set rs = Nothing
Set adoCon = Nothing
%>

</body>
</html>

---- CODE END ----
Reply With Quote
  #2 (permalink)  
Old 03-10-04, 17:28
peoplayer peoplayer is offline
Registered User
 
Join Date: Mar 2004
Posts: 4
Might be a bit obvious, but have you checked that you have write permissions?
Reply With Quote
  #3 (permalink)  
Old 03-10-04, 19:17
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Yes through IIS (or perhaps a control panel if on a Web host) set the permissions for the virtual (Web) folder containing the database to be more than just read only.
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
  #4 (permalink)  
Old 03-11-04, 13:22
borisrisker borisrisker is offline
Registered User
 
Join Date: Jul 2003
Posts: 8
Rights were the problem ...

Thanks everybody ...

the rights were the (stupid) problem ...

boris
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On