Dim user As String, pwd As String 通用中定义
Private Sub Command1_Click() from中定义
Dim r As ADODB.Recordset
Set r = New ADODB.Recordset
Dim strsql As String
user = txtuser
pwd = txtpwd
strsql = "select * from admin where name='" & user & "'and pwd='" & pwd & "'"
r.Open strsql, conn ------------------------------------报错语句行 报错是参数类型不正确 或不在可以接受的范围之内或于其他参数冲突
If r.EOF Then
MsgBox "登陆失败"
Else
MsgBox "登陆成功"
End If
End Sub
Private Sub command2_Click()
End
End Sub
Private Sub Form_Load()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.ConnectionString = "driver={sql server};server=dengjiaxiong;uid=sa;pwd=;dataname=school"
conn.Open
If conn.State = adStateOpen Then
MsgBox "connection successfull!"
End If
End Sub
Private Sub Label1_Click()
txtuser = ""
txtpwd = ""
End Sub
后来 有人提示 conn不是定义在窗体下,只是load过程中。所以发生错 可以把conn定义在通用那里。如:private conn as ADODB.Connection
后经改过 依然有错 提示 对象名 admin 无效 可是我的 school数据库中的确有admin表为什么无效?
请问应该如何修改 ? 每当在有调试的时候(按f8)都总是要由load开始调试 想问有什么方法可以只调试当前如command_click()的代码 占不调试其他代码的方法?