Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]修改代码,增加功能。(已解决)

1楼
yyzlxc 发表于:2011/8/1 11:04:00

下面是一段自定义用户管理窗口《删除用户》按钮的代码,要求在代码中增加用户名为“开发”的用户不能被删除的功能,代码应该如何改?请各位老师指教,谢谢!

 

Dim lst As WinForm.ListBox = e.Form.Controls("ListBox1")
If lst.SelectedIndex >=0 Then
    Dim UserName As String = lst.SelectedItem
    Dim cmd As New SQLCommand
    cmd.C     '外部数据源
    cmd.CommandText = "Delete From {Users} Where [Name] = '" & UserName & "'"
    cmd.ExecuteNonQuery
    lst.Items.RemoveAt(lst.SelectedIndex)
    lst.Select()
End If

 

 

外部数据源的代码老是贴不上?奇怪!

[此贴子已经被作者于2011-8-1 12:08:59编辑过]
2楼
狐狸爸爸 发表于:2011/8/1 11:38:00

Dim lst As WinForm.ListBox = e.Form.Controls("ListBox1")
If lst.SelectedIndex >=0 Then
    Dim UserName As String = lst.SelectedItem
    If UserName <> "开发者" Then
        Dim cmd As New SQLCommand
        cmd.C     '外部数据源
        cmd.CommandText = "Delete From {Users} Where [Name] = '" & UserName & "'"
        cmd.ExecuteNonQuery
        lst.Items.RemoveAt(lst.SelectedIndex)
        lst.Select()
    End If
End If

3楼
blackzhu 发表于:2011/8/1 11:56:00
cmd.C     '外部数据源  这个地方一直很纠结呀.显示不出来全部的.
4楼
yyzlxc 发表于:2011/8/1 12:09:00
谢谢狐爸老师,问题得到解决,再次感谢!!
共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01563 s, 2 queries.