VB连接数据库的一段程序,为什么说函数或子程序未定义
Private SqlCon As New ADODB.ConnectionPrivate SqlRes As New ADODB.Recordset
Private SqlCmd As New
Public loginname As String
Private Sub Form_Load()
SqlCon.Provider = "SQLOLEDB"
SqlCon.Open "User ID =sa;Password=123456;Initial Catalog=MBOOK;Data Source=WAK-20131119DGW"
SqlCmd.ActiveConnection = SqlCon
End Sub
Private Sub L_button_Click()
If R_radio.Value = True Then
= "SELECT * FROM TReader WHERE 借书证号=" + Trim(login_name.Text) + ""
SetSqlRes = SqlCmd.Execute
If Not SqlRes.EOF Then
If password.Text = SqlRes("密码") Then
loginname = login_name.Text
login.Hide
main.Show
Else
Call MsgBox("密码错误!")
End If
Else
Call MsgBox("登录名错误!")
End If
ElseIf A_radio.Value = True Then
= "SELECT * FROM Administrator "
Where 角色名 = "+Trim(login_name.Text)+"""
Set SqlRes = SqlCmd.Execute
If Not SqlRes.EOF Then
If password.Text = SqlRes("密码") Then
loginname = login_name.Text
login.Hide
main.Show
Else
Call MsgBox("密码错误!")
End If
Else
Call MsgBox("登录名错误!")
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
SqlCon.Close
End Sub