我按照帮助一步一步做的,用户管理及增加用户、删除用户、更改用户都可以,就是用户登录不行,提示密码错误。是不是帮助中没有读上控件中所输的密码啊?
以下是帮助示例
八、增加一个名为“用户登录”的窗口:

窗口的AfterLoad事件代码为:
Dim
cmd As New SQLCommand
Dim dt As DataTable
Dim cmb As WinForm.ComboBox = e.Form.Controls("UserName")
cmd.ConnectionName = "User"
cmd.CommandText = "SELECT DISTINCT Name From {Users}"
dt = cmd.ExecuteReader()
For Each dr As DataRow In dt.Datarows
cmb.Items.Add(dr("Name"))
Next
cmb.SelectedIndex = 0
"确定"按钮的代码为:
Dim
UserName As String = e.Form.Controls("UserName").Value
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
cmd.ConnectionName = "User"
If UserName = "" Then
Messagebox.show("请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
cmd.CommandText = "Select * From {Users} Where [Name] = '" & UserName & "'"
dt = cmd.ExecuteReader
dr = dt.DataRows(0)
If e.Form.Controls("PassWord").Value = dr("Password") Then
_UserName = UserName
_UserGroup = dr("Group")
e.Form.Close
Else
Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
“取消”按钮的代码为:
e.Form.Close()
Syscmd.Project.
Exit()
为了防止用户跳过确定和取消按钮,直接关闭窗口,请将窗口的“显示控制框”属性设置为False。