victorvillatoro
MIS
Hello, I'm getting the above error with the below code, can someone please help me see where the error is? I'm about to go seriously crazy, thanks so much in advance:
<% 'Dimension variables
Dim adoConnect 'Holds the Database Connection Object
Dim rsEmployees '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))
'Create an ADO connection object
Set adoConnect = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoConnect.Open = "DBQ="&Server.MapPath("/DEV")&"\EmployeesDB.mdb;Driver={Microsoft Access Driver (*.mdb)}"
'Create an ADO recordset object
Set rsEmployees = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM Employees_Table WHERE ID=" & lngRecordNo
'Set the cursor type we are using so we can navigate through the recordset
rsEmployees.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsEmployees.LockType = 3
'Open the recordset with the SQL query
rsEmployees.Open strSQL, adoConnect
'Update the record in the recordset
rsEmployees.Fields("First_Name") = Request.Form("First_Name")
rsEmployees.Fields("Last_Name") = Request.Form("Last_Name")
rsEmployees.Fields("Domain_Username") = Request.Form("Domain_Username")
rsEmployees.Fields("Domain_Password") = Request.Form("Domain_Password")
rsEmployees.Fields("E-mail_Password") = Request.Form("E-mail_Password")
rsEmployees.Fields("Email_Address") = Request.Form("Email_Address")
rsEmployees.Fields("Phone_Number") = Request.Form("Phone_Number")
'Write the updated recordset to the database
rsEmployees.Update
'Reset server objects
rsEmployees.Close
Set rsEmployees = Nothing
Set adoConnect = Nothing
'Return to the update select page in case another record needs editing
Response.Redirect "SelectEmployeetoUpdate.asp"
%>
<% 'Dimension variables
Dim adoConnect 'Holds the Database Connection Object
Dim rsEmployees '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))
'Create an ADO connection object
Set adoConnect = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoConnect.Open = "DBQ="&Server.MapPath("/DEV")&"\EmployeesDB.mdb;Driver={Microsoft Access Driver (*.mdb)}"
'Create an ADO recordset object
Set rsEmployees = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM Employees_Table WHERE ID=" & lngRecordNo
'Set the cursor type we are using so we can navigate through the recordset
rsEmployees.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsEmployees.LockType = 3
'Open the recordset with the SQL query
rsEmployees.Open strSQL, adoConnect
'Update the record in the recordset
rsEmployees.Fields("First_Name") = Request.Form("First_Name")
rsEmployees.Fields("Last_Name") = Request.Form("Last_Name")
rsEmployees.Fields("Domain_Username") = Request.Form("Domain_Username")
rsEmployees.Fields("Domain_Password") = Request.Form("Domain_Password")
rsEmployees.Fields("E-mail_Password") = Request.Form("E-mail_Password")
rsEmployees.Fields("Email_Address") = Request.Form("Email_Address")
rsEmployees.Fields("Phone_Number") = Request.Form("Phone_Number")
'Write the updated recordset to the database
rsEmployees.Update
'Reset server objects
rsEmployees.Close
Set rsEmployees = Nothing
Set adoConnect = Nothing
'Return to the update select page in case another record needs editing
Response.Redirect "SelectEmployeetoUpdate.asp"
%>