Hi,
When I try to update a database entry with the code which i have included below the actual entry isnt updated, instead another page is added, what could be causing this?
Regards - Darrel
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query to query the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.Form("ID_no"))
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("data.mdb")
'Create an ADO recordset object
Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblData.message, tblData.PageName, tblData.UpdatedBy FROM tblData WHERE ID=" & lngRecordNo
'Set the cursor type we are using so we can navigate through the recordset
rsUpdateEntry.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsUpdateEntry.LockType = 3
'Open the recordset with the SQL query
rsUpdateEntry.Open strSQL, adoCon
'Update the record in the recordset
rsUpdateEntry.Fields("ID")
rsUpdateEntry.Fields("message") = Request.Form("message")
rsUpdateEntry.Fields("PageName") = Request.Form("PageName")
rsUpdateEntry.Fields("UpdatedBy") = Request.Form("PageAuthor")
'Write the updated recordset to the database
rsUpdateEntry.Update
'Reset server objects
rsUpdateEntry.Close
Set rsUpdateEntry = Nothing
Set adoCon = Nothing
'Return to the update select page in case another record needs deleting
Response.Redirect "default.asp?pupdated=true"
%>