Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 登录错误访问_Vb.net_Ms Access - Fatal编程技术网

Vb.net 登录错误访问

Vb.net 登录错误访问,vb.net,ms-access,Vb.net,Ms Access,我得到一个错误,表示代码段中的表达式中存在数据不匹配: [...] If Validate_User() Then strUser = Trim(Me.txtIDNumber.Text).ToLower Dim frm As New main Me.Hide() frm.ShowDialog() Else MsgBox("Incorrect IDNumber/Password") En

我得到一个错误,表示代码段中的表达式中存在数据不匹配:

    [...]
    If Validate_User() Then
        strUser = Trim(Me.txtIDNumber.Text).ToLower
        Dim frm As New main
        Me.Hide()
        frm.ShowDialog()
    Else
        MsgBox("Incorrect IDNumber/Password")
    End If
    me1 = txtIDNumber.Text.ToString
    'txtIDNumber.Text = ""
    txtPassword.Text = ""
End Sub

Function Validate_User()
    Dim con As New OleDbConnection
    Dim cmd As New OleDbCommand
    Dim dr As OleDbDataReader
    Dim bValid As Boolean = False

    Try

        con = New OleDbConnection(Get_Constring)
        con.Open()
        cmd.Connection = con
        cmd.CommandType = CommandType.Text
        ' cmd.CommandText = "select ID from students_records where IDNumber = '" & Me.txtIDNumber.Text & "' and MiddleName = '" & Me.txtPassword.Text & "'"
        cmd.CommandText = "select IDNumber from students_records where IDNumber = '" & Me.txtIDNumber.Text & "' and MiddleName = '" & Me.txtPassword.Text & "'"

        dr = cmd.ExecuteReader
        If dr.HasRows Then
            bValid = True
        End If

    Catch ex As Exception
        MsgBox(ErrorToString)
    Finally
        con.Close()
    End Try

    Return bValid
End Function

当您单步执行代码时,在命令文本的值
cmd.CommandText=
行后,您看到了什么?单步执行:单步执行非用户代码“CIT\U教师\U评估\U系统。studentslogin.txtIDNumber.get”在哪里失败?在它失败之前会发生什么?尝试创建一个最小的命令行应用程序。。。喜欢这个,看看你失败的地方。祝你好运