以文本方式查看主题

-  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=13591)

--  作者:fagg
--  发布时间:2011/10/18 17:50:00
--  添加“用户管理”的窗口的代码出错?

利用系统自带的“自定义用户管理”的相关窗口,保存到文件,

但在新文件的窗口添加“用户登录”时,出错问题。不知何意,其他都可以,如下图,请狐哥指点。


图片点击可在新窗口打开查看此主题相关图片如下:未标题-1.jpg
图片点击可在新窗口打开查看

 

 

代码如下:

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
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

 


 

在测试中,我将上述

_UserName = UserName
_UserGroup = dr("Group")
删除,就可以,但察看原文件中是有这二行的,而且是可执行的,而在本项目中不行,,,,

[此贴子已经被作者于2011-10-18 17:59:56编辑过]

--  作者:狐狸爸爸
--  发布时间:2011/10/18 17:57:00
--  

原因在设计步骤的第四点:

http://www.foxtable.com/help/topics/2048.htm