<%
Dim Conn,rs
Dim ConnStr
Dim SQLCMD
Dim UserName
' Get user Name query string
Username=request.querystring ("UserName")
' Create a database connection object and open
Set Conn=server.createobject ("Adodb.connection")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath ("Data.mdb")
Conn.Open ConnStr
' Create a DataSet object
Set Rs=server.createobject ("Adodb.recordset")
' Query for records with user name equal to specified value
sqlcmd= "SELECT ID from user where username= '" & UserName & "'"
Rs=conn.execute (SQLCMD)
Defines a variable to indicate whether the user name exists
Dim exist
Determine if a user name exists based on whether there is data
If Rs.eof then exist=1 else exist=0
To close a database connection
Rs.close
Conn.close
Set rs=nothing
Set conn=nothing
Returns the result
Response.Write (exist)
%>