VB界面上 我用了ADODC控件 里面的connectionstring 有设值 adcmdtext也有设值
下面的为代码。。Dim sql As String
If Trim(T1.Text) = "" Or Trim(T2.Text) = "" Then
MsgBox "您还没有输入信息,请输入!", vbOKOnly + vbExclamation, "提示!"
T1.SetFocus
T1.Text = ""
Else
sql = "select * from login where username = '" & Trim(T1.Text) & "'"
ado.RecordSource = sql
If ado.Recordset.EOF = True Then
MsgBox "您输入的用户名不存在,请重新输入!", vbOKOnly + vbExclamation, "提示!"
T1.SetFocus
T1.Text = ""
Else
If ado.Recordset.Fields(Password) <> Trim(T2.Text) Then
MsgBox "您输入的密码有误,请重新输入!", vbOKOnly + vbExclamation, "提示!"
T2.SetFocus
T2.Text = ""
Else
Me.Hide
index.Show
End If
End If
End If小弟新手 很少用VB
求助啊
下面的为代码。。Dim sql As String
If Trim(T1.Text) = "" Or Trim(T2.Text) = "" Then
MsgBox "您还没有输入信息,请输入!", vbOKOnly + vbExclamation, "提示!"
T1.SetFocus
T1.Text = ""
Else
sql = "select * from login where username = '" & Trim(T1.Text) & "'"
ado.RecordSource = sql
If ado.Recordset.EOF = True Then
MsgBox "您输入的用户名不存在,请重新输入!", vbOKOnly + vbExclamation, "提示!"
T1.SetFocus
T1.Text = ""
Else
If ado.Recordset.Fields(Password) <> Trim(T2.Text) Then
MsgBox "您输入的密码有误,请重新输入!", vbOKOnly + vbExclamation, "提示!"
T2.SetFocus
T2.Text = ""
Else
Me.Hide
index.Show
End If
End If
End If小弟新手 很少用VB
求助啊
就是想不写connectionstring后面的那一串代码 用ADO控件手动点击代替就好
然后就出来这个问题了
(貌似不完全是这样,估计代码也有问题)
求高手给予帮助。
自己解决了 。 还真是暴汗啊
原来
sql = "select * from login where username = '" & Trim(T1.Text) & "'"
ado.RecordSource = sql
这个后面要接:
ado.Refresh
才能用。
不过貌似后面的程序也是错误多多。