Foxtable(狐表)用户栏目专家坐堂 → [求助]更新SQL数据问题


  共有7412人关注过本帖平板打印复制链接

主题:[求助]更新SQL数据问题

帅哥哟,离线,有人找我吗?
jaegea
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:480 积分:3832 威望:0 精华:0 注册:2011/5/31 15:45:00
[求助]更新SQL数据问题  发帖心情 Post By:2012/4/27 17:39:00 [只看该作者]

Dim TimingNumber As String = e.Form.Controls("TimingNumber").Value
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 Post As String = e.Form.Controls("Post").Value
Dim Position As String = e.Form.Controls("Position").Value
Dim Authority As WinForm.CheckBox
Authority = e.Form.Controls("Authority")
Dim OldUserName As String
If e.Form.Controls("PassWord1").Value <> e.Form.Controls("PassWord").Value Then
 Messagebox.show("請輸入登錄工號!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Dim cmd As New SQLCommand
Dim Parts() As String = e.Form.Text.Split("-")
OldUserName =  Parts(Parts.Length -1)
cmd.C
If TimingNumber = "" Then
    Messagebox.show("請輸入登錄工號!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If
Dim F As Integer
If Authority.Checked = False Then
   F = 0
  Else
   F = 1
End If
cmd.CommandText = "Update {用戶表} Set [工號] =  '" & TimingNumber & "', [用戶名] = '" & UserName & "',[部門] = '" & UserGroup  & "', [職務] = '" & Post & "', [職位] = '" & Position & "', [特殊權限] = '" & F & "', [密碼] = '" & 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

 

 

总是更改用户失败,不知道哪里出问题,请高手帮忙看看


 回到顶部