-- 作者:aduydgd
-- 发布时间:2013/2/27 11:52:00
--
Afterload事件:
Dim cmd As New SQLCommand Dim dt As DataTable Dim cmb As WinForm.ComboBox = e.Form.Controls("UserName") cmd.C 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.C If UserName = "" Then Messagebox.show("请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If cmd.CommandText = "Select * From {Users} Where [Name] = \'" & UserName & "\'" dt = cmd.ExecuteReader If dt.DataRows.Count = 0 Then Messagebox.show("此用户不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If 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)
取消按钮:
此主题相关图片如下:1.jpg
此主题相关图片如下:2.jpg
|