找回密码
 加入
搜索
查看: 2459|回复: 2

[AU3基础] SQLite 更新数据报21错误:错误的库使用。请求帮忙!

[复制链接]
发表于 2012-2-29 20:39:40 | 显示全部楼层 |阅读模式

为何在执行351行时,老是报21错误。
窗口操作重现方法:点击左边的公司名称,在右下部,修改公司信息后,保存。就报错了!
#include <ComboConstants.au3>
#include <Constants.au3>
#include <EditConstants.au3>
#include <GDIPlusConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <StructureConstants.au3>
#include <TabConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <Timers.au3>
#include <GuiStatusBar.au3>
#include <GuiListView.au3>
#include <Excel.au3>
#include <Word.au3>
#include <GuiTreeView.au3>
#include <Date.au3>
#include <GDIPLUS.au3>
Opt('MustDeclareVars', 1)

Global $dirData = @ScriptDir & "\data"
Global $photoData = @ScriptDir & "\Photo"
Global $jlData = @ScriptDir & "\Resume"
Global $docData = @ScriptDir & "\ReviewReport"
Global $db = @ScriptDir  & "\data.db"
Global $Globle_EmployeeID = 0, $Globle_CompanyID = 0, $Review_targetID = 0, $Globle_ReviewID = 0

_SQLite_Startup() ;加载 SQLite.dll

Dim $Main, $MenuItem1, $MenuItem4, $MenuItem5, $MenuItem6, $MenuItem8, $MenuItem9, $MenuItem10, $MenuItem13, $MenuItem2, $MenuItem3, $MenuItem11, $MenuItem12, $MenuItem14
Dim $StatusBar, $TreeView_personal, $Tab1, $TabSheet1
Dim $Label_p_xm, $Input_p_xm, $Label_p_xb, $Combo_p_xb, $Label_p_nl, $Input_p_nl, $Label_p_id, $Input_p_id, $Ps_photo, $Lable_p_gs, $Combo_p_gs
Dim $Label_p_xl, $Input_p_xl, $Label_p_zy, $Input_p_zy, $Label_p_zc, $Input_p_zc, $Label_p_tel, $Input_p_tel, $Label_p_email, $Input_p_email
Dim $Button_add_ps, $Button_save_ps, $Button_del_ps, $TabSheet2, $Label_p_js, $Label_p_zt, $Label_p_ryzt, $Label1, $Label_p_z, $Input_ps_js
Dim $Input_ps_fwzt, $Label_ps_lvl, $Input_ps_lvl, $Input_ps_ryzt, $Input_ps_sDate, $Input_ry_eDate, $Label2, $Input_ps_Pay, $TabSheet3, $Pic_preview
Dim $Button_selectphoto, $Button_deletephoto, $Button_addJL, $Button_viewJL, $Button_deleteJL, $TabSheet4, $ListView_p_psjl
Dim $Group_CoBasic, $Label_gsmc, $Label_gsdz, $Input_gsmc, $Input_gsdz, $Label_frdb, $Label_gsdh, $Input_frdb, $Input_gsdh, $Label_gscz
Dim $Input_gscz, $Label_lxdh, $Input_lxdh, $Label_yzbm, $Input_yzbm, $Label_c_id, $Input_c_id, $Button_add_co, $Button_save_co, $Button_del_co, $Label3
Dim $RC_menu, $rc1
#region ### START Koda GUI section ### Form=X:\我的开发\外包人员管理SQLITE版\窗口源文件\Main.kxf
$Main = GUICreate("外包人员管理SQLITE版", 1000, 700, (@DesktopWidth - 1000) / 2, (@DesktopHeight - 700) / 2)
$MenuItem1 = GUICtrlCreateMenu("评审(&R)")
$MenuItem4 = GUICtrlCreateMenuItem("人员评定与审核", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("评审情况一览表", $MenuItem1)
$MenuItem6 = GUICtrlCreateMenu("批量(&E)")
$MenuItem8 = GUICtrlCreateMenuItem("导出照片", $MenuItem6)
$MenuItem9 = GUICtrlCreateMenuItem("导出简历", $MenuItem6)
$MenuItem10 = GUICtrlCreateMenuItem("导出评审表", $MenuItem6)
$MenuItem13 = GUICtrlCreateMenuItem("通讯录", $MenuItem6)
$MenuItem2 = GUICtrlCreateMenu("设置(&O)")
$MenuItem3 = GUICtrlCreateMenuItem("参数设置", $MenuItem2)
$MenuItem11 = GUICtrlCreateMenu("帮助(&H)")
$MenuItem12 = GUICtrlCreateMenuItem("关于(&A)", $MenuItem11)
$MenuItem14 = GUICtrlCreateMenuItem("退出(&Q)", $MenuItem11)

$StatusBar = _GUICtrlStatusBar_Create($Main)
Dim $StatusBar_PartsWidth[3] = [200, 400, -1]
_GUICtrlStatusBar_SetParts($StatusBar, $StatusBar_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar, "", 0)
_GUICtrlStatusBar_SetText($StatusBar, "", 1)
_GUICtrlStatusBar_SetText($StatusBar, "", 2)
$TreeView_personal = GUICtrlCreateTreeView(56, 71, 182, 532, BitOR($GUI_SS_DEFAULT_TREEVIEW, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER))
$Tab1 = GUICtrlCreateTab(251, 70, 625, 241, $TCS_FLATBUTTONS)
$TabSheet1 = GUICtrlCreateTabItem("人员基本信息")
$Label_p_xm = GUICtrlCreateLabel("姓名:", 270, 116, 40, 17)
$Input_p_xm = GUICtrlCreateInput("", 310, 114, 81, 21)
$Label_p_xb = GUICtrlCreateLabel("性别:", 406, 116, 40, 17)
$Combo_p_xb = GUICtrlCreateCombo("", 446, 114, 41, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "男|女")
$Label_p_nl = GUICtrlCreateLabel("年龄:", 510, 116, 40, 17)
$Input_p_nl = GUICtrlCreateInput("", 550, 116, 33, 21)
$Label_p_id = GUICtrlCreateLabel("ID:", 606, 116, 27, 17)
$Input_p_id = GUICtrlCreateInput("", 630, 114, 33, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Ps_photo = GUICtrlCreatePic("", 710, 100, 150, 200, BitOR($GUI_SS_DEFAULT_PIC, $SS_NOPREFIX, $SS_CENTERIMAGE, $SS_RIGHTJUST, $SS_SUNKEN, $WS_TABSTOP))
GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Lable_p_gs = GUICtrlCreateLabel("公司:", 270, 144, 40, 17)
$Combo_p_gs = GUICtrlCreateCombo("", 310, 142, 353, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Label_p_xl = GUICtrlCreateLabel("学历:", 270, 172, 40, 17)
$Input_p_xl = GUICtrlCreateInput("", 310, 170, 57, 21)
$Label_p_zy = GUICtrlCreateLabel("专业:", 390, 172, 40, 17)
$Input_p_zy = GUICtrlCreateInput("", 430, 170, 81, 21)
$Label_p_zc = GUICtrlCreateLabel("职称:", 526, 172, 40, 17)
$Input_p_zc = GUICtrlCreateInput("", 558, 170, 105, 21)
$Label_p_tel = GUICtrlCreateLabel("手机:", 270, 204, 40, 17)
$Input_p_tel = GUICtrlCreateInput("", 310, 202, 121, 21)
$Label_p_email = GUICtrlCreateLabel("邮箱:", 454, 204, 40, 17)
$Input_p_email = GUICtrlCreateInput("", 502, 202, 161, 21)
$Button_add_ps = GUICtrlCreateButton("新增", 277, 262, 75, 25)
$Button_save_ps = GUICtrlCreateButton("保存", 401, 265, 75, 25)
$Button_del_ps = GUICtrlCreateButton("删除", 542, 265, 75, 25)
$TabSheet2 = GUICtrlCreateTabItem("附加信息")
$Label_p_js = GUICtrlCreateLabel("现场角色:", 273, 119, 64, 17)
$Label_p_zt = GUICtrlCreateLabel("服务状态:", 273, 156, 64, 17)
$Label_p_ryzt = GUICtrlCreateLabel("人员状态:", 504, 193, 64, 17)
$Label1 = GUICtrlCreateLabel("服务期限:", 273, 193, 64, 17)
$Label_p_z = GUICtrlCreateLabel("至", 395, 215, 16, 17)
$Input_ps_js = GUICtrlCreateInput("", 344, 117, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input_ps_fwzt = GUICtrlCreateInput("", 344, 154, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label_ps_lvl = GUICtrlCreateLabel("服务等级:", 504, 119, 64, 17)
$Input_ps_lvl = GUICtrlCreateInput("", 592, 117, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input_ps_ryzt = GUICtrlCreateInput("", 592, 191, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input_ps_sDate = GUICtrlCreateInput("", 344, 191, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input_ry_eDate = GUICtrlCreateInput("", 344, 233, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("人月费用:", 504, 156, 64, 17)
$Input_ps_Pay = GUICtrlCreateInput("", 592, 154, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$TabSheet3 = GUICtrlCreateTabItem("照片简历")
$Pic_preview = GUICtrlCreatePic("", 269, 99, 150, 200, BitOR($GUI_SS_DEFAULT_PIC, $SS_NOPREFIX, $SS_CENTERIMAGE, $SS_RIGHTJUST, $SS_SUNKEN, $WS_TABSTOP))
GUICtrlSetResizing(-1, $GUI_DOCKAUTO + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Button_selectphoto = GUICtrlCreateButton("导入照片", 467, 126, 75, 25)
$Button_deletephoto = GUICtrlCreateButton("删除照片", 467, 230, 75, 25)
$Button_addJL = GUICtrlCreateButton("导入简历", 707, 126, 75, 25)
$Button_viewJL = GUICtrlCreateButton("查看简历", 707, 178, 75, 25)
$Button_deleteJL = GUICtrlCreateButton("删除简历", 707, 230, 75, 25)
$TabSheet4 = GUICtrlCreateTabItem("评审记录")
$ListView_p_psjl = GUICtrlCreateListView("ID|年度|审核类型|初审结果|复审结果|终审结果|评审表编号", 258, 100, 610, 198)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 40)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 6, 70)
GUICtrlCreateTabItem("")
$Group_CoBasic = GUICtrlCreateGroup("公司基本信息", 249, 315, 628, 224)
$Label_gsmc = GUICtrlCreateLabel("公司名称:", 281, 347, 64, 17)
$Label_gsdz = GUICtrlCreateLabel("公司地址:", 281, 439, 64, 17)
$Input_gsmc = GUICtrlCreateInput("", 345, 345, 353, 21)
$Input_gsdz = GUICtrlCreateInput("", 345, 437, 457, 21)
$Label_frdb = GUICtrlCreateLabel("法人代表:", 281, 377, 64, 17)
$Label_gsdh = GUICtrlCreateLabel("公司电话:", 281, 407, 64, 17)
$Input_frdb = GUICtrlCreateInput("", 345, 375, 121, 21)
$Input_gsdh = GUICtrlCreateInput("", 345, 405, 121, 21)
$Label_gscz = GUICtrlCreateLabel("公司传真:", 513, 407, 64, 17)
$Input_gscz = GUICtrlCreateInput("", 577, 405, 121, 21)
$Label_lxdh = GUICtrlCreateLabel("联系电话:", 513, 377, 64, 17)
$Input_lxdh = GUICtrlCreateInput("", 577, 375, 121, 21)
$Label_yzbm = GUICtrlCreateLabel("邮政编码:", 281, 469, 64, 17)
$Input_yzbm = GUICtrlCreateInput("", 345, 467, 121, 21)
GUICtrlSetLimit(-1, 6)
$Label_c_id = GUICtrlCreateLabel("ID:", 713, 347, 27, 17)
$Input_c_id = GUICtrlCreateInput("", 737, 345, 57, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button_add_co = GUICtrlCreateButton("新增", 524, 483, 70, 40)
$Button_save_co = GUICtrlCreateButton("保存", 655, 483, 70, 40)
$Button_del_co = GUICtrlCreateButton("删除", 785, 483, 70, 40)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label3 = GUICtrlCreateLabel("外包人员管理", 672, 8, 308, 57)
GUICtrlSetFont(-1, 36, 800, 2, "楷体")
GUICtrlSetColor(-1, 0x0000FF)
;右键菜单
$RC_menu = GUICtrlCreateContextMenu($ListView_p_psjl)
$rc1 = GUICtrlCreateMenuItem("查看评审表", $RC_menu)
_Timer_SetTimer($Main, 1000, "_UpdateStatusBar")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
_getPersonalTree()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
        Local $nMsg = GUIGetMsg(1)
        Switch $nMsg[0]
                Case $GUI_EVENT_CLOSE
                        Switch $nMsg[1] ;  选择产生事件的窗口
                                Case $Main ;  如果是主窗口
                                        ExitLoop
                                        ;Exit ;  退出
                        EndSwitch

                Case $Button_add_co
                        _clearCoInput()
                Case $Button_save_co
                        If GUICtrlRead($Input_gsmc) = "" Then
                                MsgBox(48, '提示', '请一定要输入公司名称!')
                        Else
                                _savCoInput()
                                _getPersonalTree()
                                _clearCoInput()
                        EndIf
                Case $Button_del_co
                        ;_delCompany()
                        _getPersonalTree()

                EndSwitch
WEnd
_SQLite_Shutdown()
GUIDelete()
Exit

Func _getPersonalTree()
        _GUICtrlTreeView_DeleteAll($TreeView_personal)
        _GUICtrlTreeView_BeginUpdate($TreeView_personal)
        Local $num = _CountSelects("Select count(*) From CompanyInfo ;")
        _DebugPrint("$NUM= " & $num & @LF)
        If $num > 0 Then
                Local $hQuery, $aRow, $sQuery, $bRow
                Local $hItem[$num], $cID[$num]
                Local $x = 0
                _SQLite_Open($db)
                _SQLite_Query(-1, "Select CompanyName,CompanyID From CompanyInfo ;", $hQuery)
                While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
                        _DebugPrint($x & "==" & $aRow[0])
                        $hItem[$x] = GUICtrlCreateTreeViewItem($aRow[1] & "." & $aRow[0] & "(" & _CountSelects("Select count(*) From EmployeeInfo where CompanyID = " & $aRow[1] & ";") & ")", $TreeView_personal)
                        _SQLite_Open($db)
                        _SQLite_Query(-1, "Select EmployeeID,EmployeeName From EmployeeInfo where CompanyID = " & $aRow[1] & ";", $sQuery)
                        While _SQLite_FetchData($sQuery, $bRow) = $SQLITE_OK
                                GUICtrlCreateTreeViewItem($bRow[0] & "." & $bRow[1], $hItem[$x])
                        WEnd
                        _SQLite_Close()
                        $cID[$x] = $aRow[1]
                        $x += 1
                WEnd
                _SQLite_Close()

        EndIf
        
        _GUICtrlTreeView_Expand($TreeView_personal)
        _GUICtrlTreeView_EndUpdate($TreeView_personal)
        
EndFunc   ;==>_getPersonalTree
Func _CountSelects($str)
        Local $hQuery, $aRow, $ret
        _SQLite_Open($db)
        _SQLite_Query(-1, $str, $hQuery)
        While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
                $ret = $aRow[0]
        WEnd
        _SQLite_Close()
        Return $ret
EndFunc   ;==>_CountSelects
Func _setPersonInfoBasic()
        If $Globle_EmployeeID <> 0 Then
                Local $aRow
                _SQLite_Open($db)
                _SQLite_QuerySingleRow(-1, "Select CompanyID,EmployeeID,EmployeeName,Sexuality,Age,CompanyName,Education,Speciality,Ranks,CellPhone,Email," & _
                                "ServiceRoleName,ServiceStateName,ServiceLevelName,ServiceLevelPay,StateTypeName,ContractBeginDate,ContractEndedDate" & _
                                " From EmployeeInfo  WHERE EmployeeID = " & $Globle_EmployeeID & ";", $aRow)
                $Globle_CompanyID = $aRow[0]
                _setCoInput()
                GUICtrlSetData($Input_p_id, $aRow[1])
                GUICtrlSetData($Input_p_xm, $aRow[2])
                GUICtrlSetData($Combo_p_xb, "")
                GUICtrlSetData($Combo_p_xb, "男|女", $aRow[3])
                GUICtrlSetData($Input_p_nl, $aRow[4])
                GUICtrlSetData($Combo_p_gs, "")
;                GUICtrlSetData($Combo_p_gs, _CreatComboList("select CompanyName from  CompanyInfo "), $aRow[5])
                GUICtrlSetData($Input_p_xl, $aRow[6])
                GUICtrlSetData($Input_p_zy, $aRow[7])
                GUICtrlSetData($Input_p_zc, $aRow[8])
                GUICtrlSetData($Input_p_tel, $aRow[9])
                GUICtrlSetData($Input_p_email, $aRow[10])
                
                ;载入照片
;                Dim $array = ImageLoadFromDataBase($db, $Globle_EmployeeID)
;                If IsArray($array) Then
;                        Dim $HandleImage = $array[1][1] ;$ImageArray[0][1] = "HBITMAP"
                        ;STATIC_SETBITMAP($Ps_photo, $HandleImage)
                        ;STATIC_SETBITMAP($Pic_preview, $HandleImage)
;                Else
;                        GUICtrlSetImage($Ps_photo, '')
;                        GUICtrlSetImage($Pic_preview, '')
;                EndIf
                ;附加信息
                GUICtrlSetData($Input_ps_js, $aRow[11])
                GUICtrlSetData($Input_ps_fwzt, $aRow[12])
                GUICtrlSetData($Input_ps_lvl, $aRow[13])
                GUICtrlSetData($Input_ps_Pay, $aRow[14])
                GUICtrlSetData($Input_ps_ryzt, $aRow[15])
                GUICtrlSetData($Input_ps_sDate, $aRow[16])
                GUICtrlSetData($Input_ry_eDate, $aRow[17])
                _SQLite_Close()
                ;更新表格
                GUICtrlSendMsg($ListView_p_psjl, $LVM_DELETEALLITEMS, 0, 0)
                Local $sqr, $bRow
                _SQLite_Open($db)
                _SQLite_Query(-1, "select ReviewRecordsID,ReviewYear,ReviewTypeName,FirstReviewResult,SecondReviewResult,ThirdReviewResult,ReviewReportID from Employee_Review_Report where EmployeeID =" & $Globle_EmployeeID & ";", $sqr)
                While _SQLite_FetchData($sqr, $bRow) = $SQLITE_OK
                        GUICtrlCreateListViewItem($bRow[0] & "|" & $bRow[1] & "|" & $bRow[2] & "|" & $bRow[3] & "|" & $bRow[4] & "|" & $bRow[5] & "|" & $bRow[6], $ListView_p_psjl)
                WEnd
                _SQLite_Close()
                
        EndIf
EndFunc   ;==>_setPersonInfoBasic
Func _setCoInput()
        _SQLite_Open($db)
        Local $hQuery, $aRow
        _SQLite_Query(-1, "Select CompanyID,CompanyName,LegalName,LegalPhone,Phone,Fax,Address,PostCode From CompanyInfo WHERE CompanyID  = " & $Globle_CompanyID & ";", $hQuery)
        While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
                GUICtrlSetData($Input_c_id, $aRow[0])
                GUICtrlSetData($Input_gsmc, $aRow[1])
                GUICtrlSetData($Input_frdb, $aRow[2])
                GUICtrlSetData($Input_lxdh, $aRow[3])
                GUICtrlSetData($Input_gsdh, $aRow[4])
                GUICtrlSetData($Input_gscz, $aRow[5])
                GUICtrlSetData($Input_gsdz, $aRow[6])
                GUICtrlSetData($Input_yzbm, $aRow[7])
        WEnd
        _SQLite_Close()
EndFunc   ;==>_setCoInput
;初始化公司信息录入
Func _clearCoInput()
        $Globle_CompanyID = 0
        GUICtrlSetData($Input_c_id, "")
        GUICtrlSetData($Input_gsmc, "")
        GUICtrlSetData($Input_gsdz, "")
        GUICtrlSetData($Input_frdb, "")
        GUICtrlSetData($Input_gsdh, "")
        GUICtrlSetData($Input_gscz, "")
        GUICtrlSetData($Input_lxdh, "")
        GUICtrlSetData($Input_yzbm, "")
        GUICtrlSetState($Input_gsmc, $GUI_FOCUS)
EndFunc   ;==>_clearCoInput
;保存公司信息
Func _savCoInput()
        Local $read0 = GUICtrlRead($Input_c_id)
        Local $read1 = GUICtrlRead($Input_gsmc)
        Local $read2 = GUICtrlRead($Input_frdb)
        Local $read3 = GUICtrlRead($Input_lxdh)
        Local $read4 = GUICtrlRead($Input_gsdh)
        Local $read5 = GUICtrlRead($Input_gscz)
        Local $read6 = GUICtrlRead($Input_gsdz)
        Local $read7 = GUICtrlRead($Input_yzbm)
        ;_SQLite_Open($db)
        Local $sQuery
        If $read0 = "" And $Globle_CompanyID = 0 Then
                ;插入数据
                $sQuery = "insert into CompanyInfo (CompanyName,LegalName,LegalPhone,Phone,Fax,Address,PostCode)  values('" & $read1 & "','" & $read2 & "','" & $read3 & "','" & $read4 & "','" & $read5 & "','" & $read6 & "','" & $read7 & "');"
                _DebugPrint("sQuery= " & $sQuery & @CRLF)
                _SQLite_Open($db)
                If _SQLite_Exec(-1, $sQuery) = $SQLITE_OK Then MsgBox(48, '提示', '公司信息添加成功!')
                _SQLite_Close()
        Else
                Local $iResult
                $iResult = MsgBox(289, "警告!", "已存在该公司信息,是否更新?", 0)
                If $iResult = 1 Then
                        ;更新数据
                        $sQuery = "update CompanyInfo set  CompanyName='" & $read1 & "',LegalName='" & $read2 & "',LegalPhone='" & $read3 & "',Phone='" & $read4 & "',Fax='" & $read5 & "',Address='" & $read6 & "',PostCode='" & $read7 & "' WHERE CompanyID = " & $read0 & ";"
                        _DebugPrint("sQuery= " & $sQuery & @CRLF)
                        ;If = $SQLITE_OK Then MsgBox(48, '提示', '公司信息修改成功!')
                        _SQLite_Open($db)
                        Local $d = _SQLite_Exec($db, $sQuery)
                        If $d = $SQLITE_OK Then
                                MsgBox(48, '提示', '公司信息修改成功!')
                        Else
                                MsgBox(48, '提示', '数据库错误:' & $d)
                        EndIf
                        _SQLite_Close()
                EndIf
        EndIf
        ;_SQLite_Close()
EndFunc   ;==>_savCoInput

Func WM_NOTIFY($hWndGUI, $MsgID, $WParam, $LParam)
        Local $tagNMHDR, $Event, $hWndFrom, $IDFrom
        Local $tagNMHDR = DllStructCreate("int;int;int", $LParam)
        If @error Then Return $GUI_RUNDEFMSG
        $IDFrom = DllStructGetData($tagNMHDR, 2)
        $Event = DllStructGetData($tagNMHDR, 3)
        $tagNMHDR = 0
        Switch $IDFrom
                Case $TreeView_personal
                        Switch $Event; 选择产生的事件
                                Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
                                        If GUICtrlRead($TreeView_personal) > 0 Then
                                                _DebugPrint('ID: ' & GUICtrlRead($TreeView_personal) & @CRLF & 'Text: ' & GUICtrlRead($TreeView_personal, 1))
                                                ;MsgBox(0, '', _GUICtrlTreeView_GetText($TreeView_personal, GUICtrlRead($TreeView_personal)))
                                                Local $hItem = _GUICtrlTreeView_GetSelection($TreeView_personal)
                                                Local $hParent = _GUICtrlTreeView_GetParentHandle($TreeView_personal, $hItem)
                                                If $hParent Then
                                                        _DebugPrint("这个不是根节点 " & _GUICtrlTreeView_GetText($TreeView_personal, $hParent) & @CRLF & _GUICtrlTreeView_GetText($TreeView_personal, $hItem) & @CRLF)
                                                        Local $a = StringSplit(_GUICtrlTreeView_GetText($TreeView_personal, $hItem), ".")
                                                        $Globle_EmployeeID = $a[1]
                                                        _DebugPrint("Globle_EmployeeID = " & $Globle_EmployeeID)
                                                        _setPersonInfoBasic()
                                                Else
                                                        _DebugPrint("这个是根节点 " & _GUICtrlTreeView_GetText($TreeView_personal, $hItem) & @CRLF)
                                                        Local $a = StringSplit(_GUICtrlTreeView_GetText($TreeView_personal, $hItem), ".")
                                                        $Globle_CompanyID = $a[1]
                                                        ;_clearpsInput()
                                                        _setCoInput()
                                                EndIf
                                                
                                        EndIf
                        EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
        ConsoleWrite( _
                        "!===========================================================" & @LF & _
                        "+======================================================" & @LF & _
                        "--> 行(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
                        "+======================================================" & @LF)
EndFunc   ;==>_DebugPrint

Func _cb($aRow)
        For $s In $aRow
                ConsoleWrite( _
                                ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" & @LF & _
                                $s & @TAB & @LF & _
                                "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" & @LF)
        Next
        ConsoleWrite(@CRLF)
        ; Return $SQLITE_ABORT ; Would Abort the process and trigger an @error in _SQLite_Exec()
EndFunc   ;==>_cb

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2012-2-29 20:44:21 | 显示全部楼层
这段sql在数据库中直接执行是没有问题的。
发表于 2012-3-1 09:41:43 | 显示全部楼层
回复 1# zerozha


调用语句有问题,修改后的语句可以修改公司名称.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-16 23:45 , Processed in 0.086619 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表