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 ----