标题:初学vb 求助
取消只看楼主
k65006500
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-12-12
 问题点数:0 回复次数:0 
初学vb 求助
Private Sub Form_Load()
Dim conn As New ADODB.Connection
Dim connectionstring As String
connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ".\db1.mdb;Persist Security Info=False"
conn.Open connectionstring
End Sub
Private Sub Command1_Click()
Dim sql As String
Dim conn As New ADODB.Connection
Dim rs_login As New ADODB.Recordset
If Trim(Text1.Text) = "" Then               '检测用户名正确与否
    MsgBox "用户名不能为空,请重新输入!", vbOKOnly + vbExclamation, "错误"
    Text1.SetFocus
Else
    Set rs_login = New ADODB.Recordset
    Set conn = New ADODB.Connection
    conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ".\db1.mdb;Persist Security Info=False"
    sql = "select * from LOGIN where USERID  = '" & Text1.Text & "'"
    rs_login.Open sql, conn, 1, 1  ///至少有一个参数未被指定
    If rs_login.EOF = True Then
        MsgBox "用户名不存在,请重新输入!", vbOKOnly + vbExclamation, "错误"
        Text1 = ""
        Text2 = ""
        Text1.SetFocus
    Else                                        '检测密码正确与否
        If Trim(rs_login.Fields(1)) = Trim(Text2) Then
           If Trim(rs_login.Fields(2)) = Trim(Combo1.Text) Then
           rs_login.Close
           Unload Me
           Form1.Show
           Else
           MsgBox "身份错误,请重新选择!", vbOKOnly + vbExclamation, "错误"
           Combo1.SetFocus
           End If
        Else
            MsgBox "密码错误,请重新输入!", vbOKOnly + vbExclamation, "错误"
            Text2 = ""
            Text2.SetFocus
        End If
    End If
End If
End Sub

运行后提示红色处至少有一个参数未被指定 ,新手初学,请大家帮忙调试一下 谢谢!!
搜索更多相关主题的帖子: 检测 sql 用户名 False 
2012-12-12 17:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-390915-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.140804 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved