IF ISCLEAR(lADOConnection) THEN CREATE(lADOConnection); lADOConnection.ConnectionString:=ChaineConnection; lADOConnection.Open; //*************************************************************** Execute SP ************************* Customer1:= Code1; Customer2:=code2; lvarActiveConnection := lADOConnection; IF ISCLEAR(lADOCommand) THEN CREATE(lADOCommand); lADOCommand.ActiveConnection := lvarActiveConnection; lADOCommand.CommandText := 'TEST'; lADOCommand.CommandType := 4; lADOCommand.CommandTimeout := 0; lADOParameter:=lADOCommand.CreateParameter('@CustomerNo1', 200, 1, 20,Customer1); lADOCommand.Parameters.Append(lADOParameter); lADOParameter:=lADOCommand.CreateParameter('@CustomerNo2', 200, 1, 20,Customer2); lADOCommand.Parameters.Append(lADOParameter); // Open recordset // OSql = SQL Statement. OSQL := ' EXEC sp_makewebtask @outputfile = 'd:\testing_Hanen.xls', @query = [exec PSBI013], @colheaders =1, @FixedFont=0, @lastupdated=1, @resultstitle='Testing details' '; // Create object automation IF ISCLEAR(NavRec) THEN CREATE(NavRec); NavRec:=lADOConnection.Execute(OSql,OReturnNbRecord); // First record NavRec.MoveFirst; REPEAT // Move to next record. NavRec.MoveNext; //Until end of file. UNTIL NavRec.EOF; //Close the connection. lADOConnection.Close; // Libération des objets automation. CLEAR(NavRec); CLEAR(lADOConnection);
Comments
well, actually I'm not sure what you want to do with that code ... but maybe you should check out Waldo's BLOG about using MS ADO with NAV: http://dynamicsuser.net/blogs/waldo/archive/2008/01/06/using-stored-procedures-in-c-side.aspx
Hope this helps a little.
Kind regards,
Jörg
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool