Function GetDatabaseLocation()
Dim strDatabasePath
strDatabasePath = "data\unlock.mdb"
GetDatabaseLocation = Server.MapPath(strDatabasePath)
end function
Function GetConnectionString()
GetConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & GetDatabaseLocation()
end function
Private Function GetRecord(strQueryString)
'define SQL connection variables
Dim strConnection
Dim objConnection
Dim objRecordSet
'Define the database connection string
strConnection = GetConnectionString()
'Open the database
Set objConnection = server.createobject("ADODB.Connection")
objConnection.open strConnection
Set objRecordSet = server.createobject("ADODB.Recordset")
on error resume next
objRecordSet.CursorLocation = adUseClient
'Retrieve the user record from the database
objRecordSet.Open strQueryString, objConnection, adOpenStatic, adLockPessimistic
'Explicitly checks to see If there is a problem opening the table
if err.number then
Response.Redirect "Error.asp?number=" & err.Number & "&desc=" & Server.URLEncode(err.description) & "&Function=GetRecord¶m=" & strQueryString
End If
on error goto 0
'close the active connection
Set objRecordSet.ActiveConnection = Nothing
'return the disconnected recordset
Set GetRecord = objRecordSet
'Close the recordset and connection objects, and set them to Nothing.
objConnection.Close
Set objConnection = Nothing
End Function