mmahima Posted April 17, 2009 Share Posted April 17, 2009 When i try to execute the following statements in autoit, it is displaying wrong results, could any one help. $sqlCon = objCreate("ADODB.Connection") $objRecordSet = ObjCreate("ADODB.RecordSet") $sqlCon.Open("Provider='IBMDA400';Data Source = '10.0.1.25';User Id='USERNAME'; password='Password';") $oRs = $sqlCon.Execute("select * FROM ccdata.rcmast where MSACT# = '8217'") MSGBOX(0,"",$oRs.Fields("MSACT#").value) Link to comment Share on other sites More sharing options...
ResNullius Posted April 18, 2009 Share Posted April 18, 2009 When i try to execute the following statements in autoit, it is displaying wrong results, could any one help.$sqlCon = objCreate("ADODB.Connection")$objRecordSet = ObjCreate("ADODB.RecordSet")$sqlCon.Open("Provider='IBMDA400';Data Source = '10.0.1.25';User Id='USERNAME'; password='Password';")$oRs = $sqlCon.Execute("select * FROM ccdata.rcmast where MSACT# = '8217'")MSGBOX(0,"",$oRs.Fields("MSACT#").value)What result are you getting and what are you expecting/should you be getting? Link to comment Share on other sites More sharing options...
mmahima Posted April 20, 2009 Author Share Posted April 20, 2009 What result are you getting and what are you expecting/should you be getting?I am getting some unknown results, the expected should be 8217 Link to comment Share on other sites More sharing options...
ResNullius Posted April 20, 2009 Share Posted April 20, 2009 I am getting some unknown results, the expected should be 8217By "unknown results" do you mean a proper result, just not one you recognize from your database.Or do you mean garbage or an error? Link to comment Share on other sites More sharing options...
mmahima Posted April 20, 2009 Author Share Posted April 20, 2009 By "unknown results" do you mean a proper result, just not one you recognize from your database.Or do you mean garbage or an error?it is returning a wrong number other than the one which expected Link to comment Share on other sites More sharing options...
jchd Posted April 20, 2009 Share Posted April 20, 2009 it is returning a wrong number other than the one which expectedCan you use another SQL query tool (there are plenty hanging around for free) and try to look at the recordset returned. It could help you to understand what's going on with your query. Indeed it looks strange but seems rather an SQL than AutoIt thing. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
mmahima Posted April 21, 2009 Author Share Posted April 21, 2009 Can you use another SQL query tool (there are plenty hanging around for free) and try to look at the recordset returned. It could help you to understand what's going on with your query. Indeed it looks strange but seems rather an SQL than AutoIt thing.I used VBsedit and AutoIt. Vbsedit is retrieving correct values, where as AutoIt is retrieving wrong valuesThe following is the VBsedit code, which is retrieving correct valuesSet sqlCon = CreateObject("ADODB.Connection")Set objRecordSet = CreateObject("ADODB.Recordset")sqlCon.Open("Provider='IBMDA400';Data Source='10.0.1.25';User Id='r2k2gui4';password='r2k2gui4';")'Set oRs = sqlCon.Execute ("SELECT * FROM CCDATA.RCMAST WHERE MSACT# = '8216'") 'MsgBox(oRs.Fields("MSFRST").value)'MsgBox(oRs.Fields("MSDOWN").value)'Set oRs = sqlCon.Execute ("SELECT * from CCDATA.CCPHONE WHERE PHACT# ='8216'")'MsgBox(oRs.Fields("PHPHN#").value)'oRs.MoveNext'MsgBox(oRs.Fields("PHPHN#").value)'Set oRs = sqlCon.Execute ("SELECT MSACT#, MSFNM, MSIDESC, MSOACT# FROM CCDATA.RCMAST WHERE msssn = '587533937'") 'MsgBox(oRs.Fields("MSACT#").value)Set oRs = sqlCon.Execute ("SELECT MSACT#, MSFNM, MSIDESC, MSOACT# FROM CCDATA.RCMAST WHERE MSACT# = '960605650'") MsgBox(oRs.Fields("MSACT#").value)whereas the following is AutoIt code that is retrieving wrong values $sqlCon = ObjCreate('ADODB.Connection')$objRecordSet = ObjCreate("ADODB.Recordset")$sqlCon.Open("Provider='IBMDA400';Data Source='10.0.1.25';User Id='r2k2gui4';password='r2k2gui4';");~ $oRs = $sqlCon.Execute ("SELECT * FROM CCDATA.RCMAST WHERE MSACT# = '8216'") ;~ MsgBox(0,"",$oRs.Fields("MSFRST").value) ;Displaying wrong date values 20081100 in place of 20081101;~ MsgBox(0,"",$oRs.Fields("MSDOWN").value);~ $oRs = $sqlCon.Execute ("SELECT * from CCDATA.CCPHONE WHERE PHACT# ='8216'");~ MsgBox(0,"",$oRs.Fields("PHPHN#").value);~ $oRs.MoveNext;~ MsgBox(0,"",$oRs.Fields("PHPHN#").value) ;Displaying wrong phone number;~ $oRs = $sqlCon.Execute ("SELECT MSACT#, MSFNM, MSIDESC, MSOACT# FROM CCDATA.RCMAST WHERE msssn = '587533937'") ;~ MsgBox(0,"",$oRs.Fields("MSACT#").value) ;Displaying 960605632 which is wrong value$oRs = $sqlCon.Execute ("SELECT MSACT#, MSFNM, MSIDESC, MSOACT# FROM CCDATA.RCMAST WHERE MSACT# = '960605650'") MsgBox(0,"",$oRs.Fields("MSACT#").value) ;Displaying 960605632 which is wrong value$oRs = 0$sqlCon = 0$objRecordSet = 0 Link to comment Share on other sites More sharing options...
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