I'm trying to execute a stored proceedure, using the UDF's DBConnOpen() DBExecuteSQL() and DBConnClose()

However I the Stored proceedure returns an error number, I know the SP runs when executed on the SQL server, can anyone see anything wrong with my function?

Any help appreicated.

Code:
  

function GetDetails()
DIM $isTM,$SQLSvr,$DumpType,$awDB,$DSN,$SQLCon,$SQLCode,$EXResult,$CloseCon
$isTM=iif(ingroup("Traffic Managers"),"Ture","False")
$SQLSvr="TRNDataRep"
$DumpType="End Of Month"
$awDB="TRNHAM"

$DSN="DRIVER={SQL Server};SERVER=$SQLSvr;UID=;PWD=;DATABASE=$awDB"

;Open Connection
$SQLCon=DBConnOpen($DSN)

;Execute Stored Proceedure
$SQLCode="EXEC $awDB.dbo.awDBDump"

$EXResult=DBExecuteSQL($SQLCon, $SQLCode,4)

;Close Connection
$CloseCon=DBConnClose($SQLCon)

endfunction



Edited by Shaun (2006-03-02 04:23 AM)