<%
Dim ConnString, strSQL, RecordID
ConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database.mdb")
' ADO connection class
set my_conn= Server.CreateObject("ADODB.Connection")
' rs recordset will contain all fields in db such as userID, name, email
set rs = Server.CreateObject("ADODB.RecordSet")
' Connect ADO & open database
my_conn.Open ConnString
RecordID = Request.QueryString("ID") '# Request the ID in the querystring
If isNumeric(RecordID) = True then
strSQL = "SELECT * FROM table_name WHERE ID=" & RecordID
Else
Response.Write "Invalid Id number"
Response.End '# Stop reading ASP
End if
' Execute SQL statement
rs = my_conn.Execute(strSQL)
'# Then to write a data thats in the db you just do this:
Response.Write "column_name= " & rs("column_name")
'# (change column name to one in the db such as ID or whatever..
my_conn.close ' Close database connection
set my_conn = nothing 'obj variable released
%>