skippynz Posted December 10, 2008 Share Posted December 10, 2008 hi ppl - i have a script where im reading in 2 columns from an access 2003 database - this use to work and from memory i havent changed anything so im not sure whats happening now. i get the error below and i know what is causing the error but i just dont know how to fix it - so i come to you the autoit gods.... Line -1: Error: The requested action with this object failed I'm reading an INI for the values of my mdb file location and SQL command so heres what ive got - hopefully someone can shed som light on what im doing wrong. Heres the INI file [database] location=Invent.mdb sqlcode=SELECT Server,Shutdown from ServerInfo the short version of my code is here - the error appears after this line "$RecordSet = ObjCreate('ADODB.Recordset')" run successfully. #Include <Array.au3> #Include <File.au3> #Include <Process.au3> $INIFILE = 'Patching.ini' $FULL_MDB_FILE_NAME = IniRead($INIFILE,'database','location','') $SQL_CODE = IniRead($INIFILE,'database','sqlcode','') $CONN = ObjCreate('ADODB.Connection') $CONN.Open('Driver={Microsoft Access Driver (*.mdb)};Dbq=' & $FULL_MDB_FILE_NAME & ';') $RecordSet = ObjCreate('ADODB.Recordset') $RecordSet.Open($SQL_CODE, $CONN) $data = $RecordSet.GetRows() $RecordSet.Close $CONN.Close TIA - Craig Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 10, 2008 Share Posted December 10, 2008 hi ppl - i have a script where im reading in 2 columns from an access 2003 database - this use to work and from memory i havent changed anything so im not sure whats happening now. i get the error below and i know what is causing the error but i just dont know how to fix it - so i come to you the autoit gods.... Line -1: Error: The requested action with this object failed I'm reading an INI for the values of my mdb file location and SQL command so heres what ive got - hopefully someone can shed som light on what im doing wrong. Heres the INI file [database] location=Invent.mdb sqlcode=SELECT Server,Shutdown from ServerInfo the short version of my code is here - the error appears after this line "$RecordSet = ObjCreate('ADODB.Recordset')" run successfully. #Include <Array.au3> #Include <File.au3> #Include <Process.au3> $INIFILE = 'Patching.ini' $FULL_MDB_FILE_NAME = IniRead($INIFILE,'database','location','') $SQL_CODE = IniRead($INIFILE,'database','sqlcode','') $CONN = ObjCreate('ADODB.Connection') $CONN.Open('Driver={Microsoft Access Driver (*.mdb)};Dbq=' & $FULL_MDB_FILE_NAME & ';') $RecordSet = ObjCreate('ADODB.Recordset') $RecordSet.Open($SQL_CODE, $CONN) $data = $RecordSet.GetRows() $RecordSet.Close $CONN.Close TIA - Craig Add a COM error handler (see help file) so you can get more information. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
skippynz Posted December 11, 2008 Author Share Posted December 11, 2008 Add a COM error handler (see help file) so you can get more information. ok did as you suggested - and i get the following attached messagethanksCraig Link to comment Share on other sites More sharing options...
skippynz Posted December 11, 2008 Author Share Posted December 11, 2008 ok did as you suggested - and i get the following attached messagethanksCraigthanks for the help with the com - will have to remember that one for next time - i added some more lines to the messagebox that appears and found it was the comment fields i had added to my INI file that was causing the problem... Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 11, 2008 Share Posted December 11, 2008 thanks for the help with the com - will have to remember that one for next time - i added some more lines to the messagebox that appears and found it was the comment fields i had added to my INI file that was causing the problem...Gotta' learn things the hard way... I can relate! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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