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”在哪里失败?在它失败之前会发生什么?尝试创建一个最小的命令行应用程序。。。喜欢这个,看看你失败的地方。祝你好运