This line
strSQL = "SELECT tblName.* FROM tblStudents WHERE ID_no=" & getRecordID
looks a bit strange, shouldn't it be
strSQL = "SELECT tblStudents.* FROM tblStudents WHERE ID_no=" & getRecordID
?
I'm curious though, this seems like a long-winded way to do an update. What's wrong with executing a SQL UPDATE statement instead:
Code:
<% 'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim strSQL 'Holds the SQL query to query the database
Dim getRecordID 'Holds the record number to be updated
'Read in the record number to be updated
getRecordID= 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
'DSN connection
adoCon.Open "DSN=Guest"
'Initialise the strSQL variable with an SQL statement to update the database
strSQL = "UPDATE tblStudents "
strSQL = strSQL & "SET FName = '" & Replace(Request.Form("fname"), "'", "''") & "',"
strSQL = strSQL & "LName = '" & Replace(Request.Form("lname"), "'", "''") & "'"
strSQL = strSQL & " WHERE ID_no=" & getRecordID
'Update the record in the recordset
Const adExecuteNoRecords = 128
adoCon.Execute strSQL, , adExecuteNoRecords
'Reset server objects
adoCon.Close
Set adoCon = Nothing
%>
hth
Phil