vb+sql怎么弄登陆

来源:百度知道 编辑:UC知道 时间:2024/07/01 04:50:37
Private Sub Command1_Click()
Dim adors As New ADODB.Recordset
cn = "provider=sqloledb.1;integrated security=sspi;persist security info=false"
adors.Open "select * from login where id='+ text1 ,cn,0,3'"

While (Not adors.EOF And Not adors)
If (adors.Fields("id").Value = Text1 And adors.Fields("password").Value = Text2) Then
Form2.Hide
Form1.Show
Exit Sub
Else: adors.MoveNext
End If
Wend
If (adors.EOF) Then
MsgBox "id and password is not right "
End If

这个代码好像有问题..一直调试不成功```高手们帮我看看

我已经在SQL里做了一个表login
在VB上...已经用ADO连接上了!!!

你好好地将套接字符串练练!(我打星号的下面),熟能生巧!加油
Private Sub Command1_Click()
Dim cn As New ADODB.Connection
Dim adors As New ADODB.Recordset
cn.Open "provider=sqloledb.1;integrated security=sspi;persist security info=false"
'*********************************************
adors.Open "select * from login where id='" & Text1.Text & "' and password='" & Text2.Text & "'", cn, 0, 3
While (Not adors.EOF And Not adors)
If adors.RecordCount > 0 Then
Form2.Hide
Form1.Show
Else
MsgBox "id and password is not right "
End If
End Sub