帮我检查一下VB登录代码

来源:百度知道 编辑:UC知道 时间:2024/09/22 10:09:43
我做了一个VB、SQL程序,登录框代码如下:
Private Sub cmdOK_Click()
'表示当前用户登录所选择的身份,即用户类型, 0-管理员;1-学生;控件数组option
'根据不同的身份,选择不同的表用以查询
'main 是主窗体
If Option1(0).Value = True Then
Adodc1.RecordSource = "select * from 管理员表 where 密码='" + txtPassword.Text + " 'and 账号 ='" + txtUserName.Text + "'"
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveNext
LoginSucceeded = True
Me.Hide
main.Show
Else
MsgBox "无效的密码,请重试!", , "登录"
txtPassword.SetFocus
End If
End If
If Option1(1).Value = True Then
Adodc2.RecordSource = "select 账号 from 普通用户表 where 密码='" + txtPassword.Text + " 'and 账号 ='" + txtUserName.Text + "'"
Adodc2.Refresh
If Not Adodc2.Recordset.EOF Then

错误 1 未声明名称“Adodc1”。
错误 5 未声明名称“LoginSucceeded”。
错误 7 “SetFocus”不是“System.Windows.Forms.TextBox”的成员。
错误 8 “End If”前面必须是匹配的“If”。好像多了一个,因为你帖的不全,看不出来。

用户密码正确的前提下是普通用户进不了窗体还是管理员进不了窗体?

这个简单的程序不需要分开放吧

这个简单的程序不需要分开放吧