以文本方式查看主题

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

--  作者:653006728
--  发布时间:2014/2/19 17:42: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 [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)
End If

 

 

当没有数据库  使用内部数据表的时候 该怎么做   应该也有一页帮助吧


--  作者:Bin
--  发布时间:2014/2/19 17:45:00
--  
如果是使用相同的方式,一切都不用改变啊,只是不指定数据源即可,默认用的就是内部数据源了.

不过用内部数据源的话,何必浪费体力去自定义用户管理呢.

--  作者:653006728
--  发布时间:2014/2/19 17:46:00
--  
开发的时候用的内部数据测试啊
--  作者:Bin
--  发布时间:2014/2/19 17:49:00
--  
一切都不用改变不指定数据源即可
--  作者:653006728
--  发布时间:2014/2/19 17:54:00
--  

cmd.CommandText = "Select * From {Users} Where [Name] = \'" & UserName & "\'"
dt = cmd.ExecuteReader

 

 

那这个位置 怎么写?


--  作者:Bin
--  发布时间:2014/2/19 17:56:00
--  
无区别,不用改  另外 是 _Username 才对  username是系统变量
--  作者:653006728
--  发布时间:2014/2/19 18:04:00
--  

调试完成  谢谢

[此贴子已经被作者于2014-2-19 18:06:09编辑过]