以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]仿照说明书做的权限管理,代码出现错误。  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=28337)

--  作者:guoqi1129
--  发布时间:2013/1/25 20:43:00
--  [求助]仿照说明书做的权限管理,代码出现错误。
If Vars("用户管理") = "增加用户" Then
    
    Dim username As WinForm.TextBox = e.Form.Controls("用户名").value
    Dim password As WinForm.TextBox = e.Form.Controls("密码").value
    Dim usergroup As WinForm.ComboBox = e.Form.Controls("属性").value
    Dim cmd As New SQLCommand
    cmd.C
    If username = "" OrElse usergroup = "" Then
        Messagebox.show("请输入用户名和用户分组!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Return
    End If
    cmd.CommandText = "Insert Into {用户表} ([用户名],[属性],[密码]) Values (\'"
    cmd.CommandText = cmd.CommandText & username & "\',\'" & usergroup & "\',\'" & password & "\')"
    If cmd.ExecuteNonQuery = 1 Then \'返回1表示增加成功
        With Forms("用户管理").Controls("ListBox1")
            .Items.Add(username)
            .SelectedIndex = .Items.Count -1
        End With
    Else
        Messagebox.show("增加用户失败, 可能存在同名用户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
    
End If
代码保存时显示编译错误:重载决策失败,原因是没有可访问的“=“可以调用这些参数,错误代码是标黄代码。

--  作者:lin_hailun
--  发布时间:2013/1/26 13:51:00
--  
 已在你的另一个帖子里回答了。

  Dim username As String = e.Form.Controls("用户名").value
  Dim password As String = e.Form.Controls("密码").value
  Dim usergroup As String = e.Form.Controls("属性").value