已經搞定,不是移什麼位置,是要再加一個判斷
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
Dim dr2 As DataRow
dr2 = DataTables("用戶表").Find("[用戶] = '" & UserName & "'")
If dr2 IsNot Nothing Then
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
Else
Messagebox.show("用戶名错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
[此贴子已经被作者于2012-4-23 11:57:39编辑过]