以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 求指点,状态栏登陆用户显示问题。  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=30388)

--  作者:bahamute
--  发布时间:2013/3/27 9:11:00
--  [求助] 求指点,状态栏登陆用户显示问题。

设置如下代码后,状态栏用户显示为“开发2”,而不是登陆用户,不知何故(使用的access数据库保存用户信息)。

StatusBar.Message2= "当前用户:" & User.Name &  "  今天日期:"  & Date.Today


--  作者:bahamute
--  发布时间:2013/3/27 9:37:00
--  
 

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 [用户] = \'" & UserName & "\'"

dt = cmd.ExecuteReader

dr = dt.DataRows(0)

If e.Form.Controls("PassWord").Value = dr("密码") Then

    _UserName = UserName

    _UserGroup = dr("用户组")

    e.Form.Close

Else

    Messagebox.show("密码错误!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)

End If


--  作者:bahamute
--  发布时间:2013/3/27 9:57:00
--  
非常感谢。