我想做个登陆界面,是这样写的
Private Sub Command1_Click()
Dim cnn As New ADODB.Connection
Dim rs1 As New ADODB.Recordset
Dim cmd As New ADODB.Command
cnn.ConnectionString = ("provider=SQLOLEDB.1;Persist Security Info=False;Integrated Security=SSPI;CATALOG=车辆管理正式版;")
cnn.Open
Set rs1.ActiveConnection = cnn
rs1.Open ("use 车辆管理正式版 select * from zhanghu where 用户名='" & Text1.Text & "' and 密码='" & Text2.Text & "'")
If rs1.EOF = True Then
MsgBox "用户名或密码错误!", vbInformation, "警告"
Text1.Text = ""
Text2.Text = ""
Else
Unload Me
MsgBox "登录成功"
Form2.Show
End If
rs1.Close
End Sub
但是一直提示对象关闭时不允许操作~求助啊。。。
Private Sub Command1_Click()
Dim cnn As New ADODB.Connection
Dim rs1 As New ADODB.Recordset
Dim cmd As New ADODB.Command
cnn.ConnectionString = ("provider=SQLOLEDB.1;Persist Security Info=False;Integrated Security=SSPI;CATALOG=车辆管理正式版;")
cnn.Open
Set rs1.ActiveConnection = cnn
rs1.Open ("use 车辆管理正式版 select * from zhanghu where 用户名='" & Text1.Text & "' and 密码='" & Text2.Text & "'")
If rs1.EOF = True Then
MsgBox "用户名或密码错误!", vbInformation, "警告"
Text1.Text = ""
Text2.Text = ""
Else
Unload Me
MsgBox "登录成功"
Form2.Show
End If
rs1.Close
End Sub
但是一直提示对象关闭时不允许操作~求助啊。。。