Dim UserName As String = e.Form.Controls("UserName").Value
Dim db = HySq-l.DataBaseFactory.CreateDatabase("YF123")
If UserName = "" Then
Messagebox.show("请选择用户!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return
End If
Dim Sq-l = "Selec-t * From Users Where Name = '" & UserName & "'"
Dim dt As system.data.DataTable = db.ExecuteDataSet(Sq-l).Tables(0)
'Msgbox(dt.Rows.Count)
Msgbox(1)
'If dt.DataRows.Count = 0 Then 'ACCESS---EF
If dt.Rows.Count = 0 Then
Messagebox.show("此用户不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return
End If
Msgbox(2)
Dim dr As system.data.DataRow
dr = dt.Rows(0) '
Msgbox(3)
'e.Form.Controls("PassWord").BindingField = "用户登录_Table1.PassWord"
If e.Form.Controls("PassWord").Value = dr("Password") Then
_UserName = UserName
_UserGroup = dr("Group")
_UserRole = dr("Role")
e.Form.Close
Else
Messagebox.show("密码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Msgbox(4)
红代码执行报错:从类型“DBNull”到类型“String”的转换无效。