What happens if you remove the SQLExec from the IF command:
LOCAL lcQUERY, lnHandle, lnRetVal
lcQUERY = "SELECT COM_CODE COMMANDE," ;
+"COM_INTITULE INTITULE ....." Approx. : 2700chars long.
lnHANDLE = SQLCONNECT("ODBC_CONNECTION")
IF lnHANDLE<=0
return .f.
ENDIF
lnRetVal = SQLEXEC(lnHANDLE, lcQUERY, "CUR_TEMP")
IF lnRetVal <= 0
SQLDISCONNECT(lnHANDLE)
ENDIF
Also, if you were to upgrade to VFP 7 SP1 [if you have not already done so], then you can send information to the VFP Team at Microsoft that will help them address this fatal exception. The functionality for error reporting was introduced in VFP7 Service Pack 1. For anyone already using Service Pack 1, you can click the Send Error Report button in the error dialog that appears. If not, you can update Visual FoxPro 7 to Service Pack 1 by downloading the service pack from
http://msdn.microsoft.com/vfoxpro/downloads/updates.asp and installing it.
>I used to get this error but not always:
>
>Erreur irrécupérable : Code d'exception=C0000005 @ 2002/02/01 10:13:37. Fichier journal d'erreurs : D:\Kitchantier\Kitchantier\Exe\VFP7Rerr.log
> Appelé à partir de rap_cac line 1172 {D:\Kitchantier\Kitchantier\Exe\progs\rapports.prg rapports.fxp}
> Appelé à partir de ON... line 0 { }
> Appelé à partir de main line 79 {D:\Kitchantier\Kitchantier\Exe\progs\main.prg d:\kitchantier\kitchantier\exe\kitchantier.exe}
>
>This is my code:
>LOCAL lcQUERY
> lcQUERY = "SELECT COM_CODE COMMANDE," ;
> +"COM_INTITULE INTITULE ....." Approx. : 2700chars long.
>
>lnHANDLE = SQLCONNECT("ODBC_CONNECTION")
>IF lnHANDLE<=0 .OR. SQLEXEC(lnHANDLE, lcQUERY, "CUR_TEMP")<=0
> SQLDISCONNECT(lnHANDLE)
>ENDIF
>
>
>The C000005 error is always on the SQLEXEC() function.
>
>Why?
>
>Thanks a lot
Mark McCasland
Midlothian, TX USA