以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]sql的邏輯列內容怎麼更新呀?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=18993)

--  作者:jaegea
--  发布时间:2012/4/24 11:57:00
--  [求助]sql的邏輯列內容怎麼更新呀?

Dim UserName As String = e.Form.Controls("UserName").Value
Dim UserGroup As String  = e.Form.Controls("UserGroup").Value
Dim PassWord As String = e.Form.Controls("PassWord").Value
Dim Position As String = e.Form.Controls("Position").Value
Dim Authority As Boolean = e.Form.Controls("Authority").Checked
Dim OldUserName As String
Dim cmd As New SQLCommand
Dim Parts() As String = e.Form.Text.Split("-"c)
OldUserName =  Parts(Parts.Length -1)
cmd.C
If UserName = "" OrElse UserGroup = "" Then
    Messagebox.show("請輸入部門名稱和用戶名!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If
cmd.CommandText = "Update {用戶表} Set [用戶名] = \'" & UserName & "\',[部門] = \'" & UserGroup
cmd.CommandText = cmd.CommandText & "\',[職務] = \'" & Position
cmd.CommandText = cmd.CommandText & "\',  [特殊權限] = \'" & Authority & "\', [密碼] = \'" & Password & "\' Where [用戶名]= \'" & OldUserName & "\'"
If cmd.ExecuteNonQuery = 1 Then \'返回1表示更改成功
   Messagebox.show("更改用戶信息成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    If Forms("用戶管理").Opened Then
        With Forms("用戶管理").Controls("ListBox1")
            .Items(.SelectedIndex) = UserName
        End With
    End If
    e.Form.Close
Else
    Messagebox.show("更改用戶失敗!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

 

 

SQL語句那裡通不過,更改用戶失敗,Authority 是邏輯列的變量,就是這個出問題


--  作者:狐狸爸爸
--  发布时间:2012/4/24 11:59:00
--  

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