Re: [Func] ADOSQL - wraps ADO for executing SQL queries (AHK-L)
Posted: 09 Jan 2016, 01:55
A few more observations.. Note: I could be very wrong Iabout all of this, however, 'm just providing my own use observations in case it helps anyone..
It doesn't seem like either ErrorLevel or A_LastError are returned by ADO when errors are produced (atleast it doesn't seem like it is for me)
hence, the Error section never triggers for me
hence
always return true
and the corresponding else error section never fire for me:
Checking for erros via
seems to work correctly for me.... but like I said at the start.. I've mostly likely screwed something up royally... so don't hold me to anything I say!
Hopefully I haven't butchered your code too badly VxE..! But your function has helped greatly!
Cheers!
It doesn't seem like either ErrorLevel or A_LastError are returned by ADO when errors are produced (atleast it doesn't seem like it is for me)
hence, the Error section never triggers for me
hence
Code: Select all
If !( coer := A_LastError )
oRec := oCon.execute( ADOSQL_LastQuery := Query_Statement)
If !( coer := A_LastError ) ; The query executed OK, so examine the recordsets.
{
and the corresponding else error section never fire for me:
Code: Select all
Else ; Oh NOES!! Put a description of each error in 'ADOSQL_LastError'.
{
oErr := oCon.Errors ; > http://www.w3schools.com/ado/ado_ref_error.asp
Query_Statement := "x"
Loop % oErr.Count
{
oFld := oErr.Item( A_Index - 1 )
str := oFld.Description
Query_Statement .= "`n`n" SubStr( str, 1 + InStr( str, "]", 0, 2 + InStr( str, "][", 0, 0 ) ) )
. "`n Number: " oFld.Number
. ", NativeError: " oFld.NativeError
. ", Source: " oFld.Source
. ", SQLState: " oFld.SQLState
}
ADOSQL_LastError := SubStr( Query_Statement, 4 )
Query_Statement := ""
txtout := 1
}
Code: Select all
oErr := oCon.Errors ; > http://www.w3schools.com/ado/ado_ref_error.asp
if(oErr)
msgbox % "ERROR present!"
Else
msgBox % "No error present!"
Hopefully I haven't butchered your code too badly VxE..! But your function has helped greatly!
Cheers!