Dim
conn
As
New
ADODB.Connection
Dim strConn As String
Dim sql As String
'连接串
strConn = " Provider=microsoft.jet.oledb.4.0;Data Source= " & _
Server.MapPath( "Data\users .mdb " )
'SQL查询语句
sql = " select PhoneNumber from users where UserName like ' " & _
Me .txtUserName.Text.ToString & " '"
'与数据库建立连接
conn.ConnectionString = strConn
conn.Open()
'执行SQL查询,并将结果保存在Recordset对象中
Dim rs As New ADODB.Recordset
rs.ActiveConnection = conn
rs = conn.Execute(sql)
'使用查询结果
While Not rs. EOF
If rs( " PhoneNumber " ).Value = Me .txtPhoneNumber.Text Then
Response.Write( " Correct " )
Else
Response.Write("Wrong")
End If
rs.MoveNext()
End While
Dim strConn As String
Dim sql As String
'连接串
strConn = " Provider=microsoft.jet.oledb.4.0;Data Source= " & _
Server.MapPath( "Data\users .mdb " )
'SQL查询语句
sql = " select PhoneNumber from users where UserName like ' " & _
Me .txtUserName.Text.ToString & " '"
'与数据库建立连接
conn.ConnectionString = strConn
conn.Open()
'执行SQL查询,并将结果保存在Recordset对象中
Dim rs As New ADODB.Recordset
rs.ActiveConnection = conn
rs = conn.Execute(sql)
'使用查询结果
While Not rs. EOF
If rs( " PhoneNumber " ).Value = Me .txtPhoneNumber.Text Then
Response.Write( " Correct " )
Else
Response.Write("Wrong")
End If
rs.MoveNext()
End While