我們用的是adodc插件,mysql資料庫
代碼如下:
Private Sub Command1_Click()
Adodc1.RecordSource = " select * from '學生用戶資訊表' "
Adodc2.RecordSource = " select * from '管理員資訊表' "
Dim a As Single
a = 0
If Option2.Value = True Then '用戶系統
If Option1.Value = False And Option2.Value = False Then
MsgBox "請選擇您的身份" '確保身份不為空
End If
If Text1.Text = "" Then
MsgBox "用戶名不能為空,請重新輸入" '保證用戶名和密碼不為空
End If
Do Until Adodc1.Recordset.EOF
If Text1.Text = Adodc1.Recordset.Fields("student id") And Text2.Text = Adodc1.Recordset.Fields("passeord") Then
登錄界面.Hide
訂閱界面.Show
Exit Do
a = a + 1
End If
Loop
If a = Adodc1.Recordset.RecordCount Then
MsgBox "您的賬號或密碼輸入錯誤"
End If
Else
If Option1.Value = False And Option2.Value = False Then
MsgBox "請選擇您的身份" '確保身份不為空
End If
If Text1.Text = "" Then
MsgBox "用戶名不能為空,請重新輸入" '保證用戶名和密碼不為空
Text1.SetFocus '游標回傳
End If
Do Until Adodc1.Recordset.EOF
If Text1.Text = Adodc1.Recordset.Fields("manager id") And Text2.Text = Adodc1.Recordset.Fields("passeord") Then
登錄界面.Hide
管理員界面.Show
Exit Do
a = a + 1
End If
Loop
If a = Adodc2.Recordset.RecordCount Then
MsgBox "您的賬號或密碼輸入錯誤"
End If
End If
End Sub
uj5u.com熱心網友回復:
連接mysql資料庫的話需要安裝mysql驅動uj5u.com熱心網友回復:
With 塊變數沒有設定(錯誤 91)看看是不是有物件為Nothing
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/8856.html
上一篇:VB6計算器制作
下一篇:vb連接RDS資料庫 報錯
