Foxtable(狐表)用户栏目专家坐堂 → 连接SQsever登录问题(测试)


  共有11838人关注过本帖树形打印复制链接

主题:连接SQsever登录问题(测试)

帅哥哟,离线,有人找我吗?
狐狸爸爸
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/10/18 14:30:00 [只看该作者]

你确定按钮当然要出错,应为你屏蔽了这行代码:

 

 

Dim UserName As String = e.Form.Controls("UserName").Value
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
'cmd.Connection Name = "test2"   外部数据源
If UserName = ""  Then
    Messagebox.show("请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If


 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/10/18 14:33:00 [只看该作者]

Dim UserName As String = e.Form.Controls("UserName").Value
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
'cmd.Connection Name = "test2" 外部数据源
If UserName = ""  Then
    Messagebox.show("请选择用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If
cmd.CommandText = "Select * From {用户表} Where [用户名称] = '" & 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("登录密码") Then
    _UserName = UserName
    _UserGroup = dr("分组名称")
    e.Form.Close

For Each t As Table In Tables
    t.Visible = True
    t.AllowEdit = True
    For Each c As Col In t.Cols
        c.Visible = True
        c.AllowEdit = True
    Next
Next

Tables("授权表").Visible = (_UserGroup = "管理人员A")

For Each dr1 As DataRow In DataTables("授权表").Select("分组名称 = '" & _UserGroup & "'" )
    If dr1.IsNull("列名称") Then
        Tables(dr1("表窗名称")).Visible = Not dr1("不可见")
        Tables(dr1("表窗名称")).AllowEdit = Not dr1("不可编辑")
    Else
        Tables(dr1("表窗名称")).Cols(dr1("列名称")).Visible = Not dr1("不可见")
        Tables(dr1("表窗名称")).Cols(dr1("列名称")).AllowEdit = Not dr1("不可编辑")
    End If
Next
   If  _usergroup <> "管理人员A" Then
      Tables("授权表").Visible = False
    Else
       Tables("授权表").Visible = True  
    End If

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

 

好好看看这里:

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

知道这么找出出错的代码,这样就能更快地找出原因。

 

此外要知道: 重定向之后,新数据库中的表是空的,你得重新增加用户来测试。

[此贴子已经被作者于2012-10-18 14:42:34编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
douglas738888
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1172 积分:8772 威望:0 精华:0 注册:2012/4/18 16:28:00
  发帖心情 Post By:2012/10/18 17:44:00 [只看该作者]

谢谢狐爸!!!要好好学习学习

 回到顶部
总数 13 上一页 1 2