stockboy Posted January 8, 2007 Posted January 8, 2007 This script connects to an oracle database, gets the version of the program 'CI' and writes it in version.log. My question: what do I have to change, in the script, to PUT data in the database instead of GET data. For example: "update mnbarm set MNBARMART60MAXSOCECONEUR = 21356.63 where mnbarmmaand >= '01-JAN-07'" instaed of "select upgrade_version ||''||upgrade_build from ci_toepassing where kode like 'CI'" I know... I don't know much 'bout databases, shame on me ;o) ------------------------------------------------------------------------------ Dim $oMyError $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $ado = ObjCreate( "ADODB.Connection" ) With $ado .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='mig2';User Id='cipal';Password='xxxx';") .Open EndWith $adors = ObjCreate( "ADODB.RecordSet" ) With $adors .ActiveConnection = $ado .Source = "select upgrade_version ||''||upgrade_build from ci_toepassing where kode like 'CI'" .Open EndWith While not $adors.EOF For $i = 0 To $adors.Fields.Count - 1 FileWriteLogOracle("c:\version.log",$adors.Fields( $i ).Value & @TAB) Next $adors.MoveNext WEnd Func MyErrFunc() Endfunc Func FileWriteLogOracle($sLogPath, $sLogMsg) EndFunc
ptrex Posted January 8, 2007 Posted January 8, 2007 @stockboyIn order to add the data to a database you need to use the INSERT command instead of the UPDATE.See here for more info : INSERTRegardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
stockboy Posted January 8, 2007 Author Posted January 8, 2007 @ptrex I mean: 'edit' the database (insert, update, etc...) If I use: "select upgrade_version ||''||upgrade_build from ci_toepassing where kode like 'CI'" the script works. If I use: "update mnbarm set MNBARMART60MAXSOCECONEUR = 21356.63 where mnbarmmaand >= '01-JAN-07'" it gives this error: "operation is not allowed when the object is closed"
ptrex Posted January 8, 2007 Posted January 8, 2007 @In order to update or change record via ADOR you need to use the EXECUTE command.see more info here EXECUTEGroeten,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
stockboy Posted January 17, 2007 Author Posted January 17, 2007 CODE$ado = ObjCreate( "ADODB.Connection" ) With $ado .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source=" & $SID & ";User Id='xxxx';Password='xxxx';") .Open EndWith $adors = ObjCreate( "ADODB.RecordSet" ) With $adors .ActiveConnection = $ado .Execute ("UPDATE PRN_SYSTEEM SET WAARDE = '060204' WHERE CODE = 'PROGRAMVERSIE+'") .Open EndWith While not $adors.EOF For $i = 0 To $adors.Fields.Count - 1 FileWriteLogOracle($pad6 &"Parn_060204.log",$adors.Fields( $i ).Value & @TAB) Next $adors.MoveNext WEnd @Ptrex (or other experts ;o) Something like this? What am I doing wrong? It still gives an error TNX Stockboy
ptrex Posted January 18, 2007 Posted January 18, 2007 @stockboy Run this again, added some error checking routine ; Initialize COM error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $ado = ObjCreate( "ADODB.Connection" ) With $ado .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source=" & $SID & ";User Id='xxxx';Password='xxxx';") .OpenEndWith$adors = ObjCreate( "ADODB.RecordSet" ) With $adors .ActiveConnection = $ado .Execute ("UPDATE PRN_SYSTEEM SET WAARDE = '060204' WHERE CODE = 'PROGRAMVERSIE+'") .OpenEndWithWhile not $adors.EOF For $i = 0 To $adors.Fields.Count - 1 FileWriteLogOracle($pad6 &"Parn_060204.log",$adors.Fields( $i ).Value & @TAB) Next $adors.MoveNext WEnd Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc Let me know which errors come out into SciTe and COM error routine. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
stockboy Posted January 23, 2007 Author Posted January 23, 2007 @ptrexIt gives the following error's:1) 2) 3) What's wrong ? Tnx Stockboy
ptrex Posted January 23, 2007 Posted January 23, 2007 @stockboylook here for Ora-14007 error code OraErrorsThere seems to be something wrong with the command syntax you used.regardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now