Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
下面是一段自定义用户管理窗口《删除用户》按钮的代码,要求在代码中增加用户名为“开发”的用户不能被删除的功能,代码应该如何改?请各位老师指教,谢谢!
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
外部数据源的代码老是贴不上?奇怪!
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