Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
Bonjour,
Lors d'un appel de procédure stockée, SQLCA.SQLCode = -1 et SQLCA.SQLErrText = "A SQLServer request resulted in a bad return code or status but no error message was returned".
Environnement : PB9 et SQLServer 2000
SQLCA.dbParm = "Async = 1" SQLCA.sp_util_maproc(ls_param) IF SQLCA.SQLCode < 0 THEN MessageBox(gAppNom, "Erreur :~r" + SQLCA.SQLErrText, StopSign!) SQLCA.dbParm = "Async = 0" Return END IF
Rien n'apparait dans le SQL Trace.
Ma procédure stockée exécutée dans le Query Analyzer fonctionne sans erreur.
Cette procédure effectue des INSERT, puis exécute une procédure qui envoie un e-mail à l'utilisateur pour lui signifier que le traitement est terminé.
Hors ligne
Salut
il n'y aurait pas un print dans ta proc ?
Hors ligne
JCZ a écrit:
Salut
il n'y aurait pas un print dans ta proc ?
Et non... Par contre avec la syntaxe suivante, ça fonctionne :
PREPARE SQLSA FROM "EXEC sp_util_maproc ?" ; EXECUTE SQLSA USING :ls_param ;
Hors ligne
SQLCA.dbParm = "Async = 1" SQLCA.sp_util_maproc(ls_param) IF SQLCA.SQLCode < 0 THEN MessageBox(gAppNom, "Erreur :~r" + SQLCA.SQLErrText, StopSign!) SQLCA.dbParm = "Async = 0" Return END IF
ce code marche si tu enlèves l'envoi du mail ?
Hors ligne
Non plus. Par contre j'ai aussi
SET @cmd = 'BCP "' + @ls_query + '" QUERYOUT \\MONSERVEURDEFICHIER\MONPARTAGE\monfichier.txt /c /e \\MONSERVEURDEFICHIER\MONPARTAGE\monfichier.err /b1000 /Usa /Psqlsa /SMONSERVEURDEDONNEES' EXEC MASTER..xp_cmdshell @cmd
Si je le mets en commentaires : Idem.
Hors ligne
Excusez moi, mais je ne pense pas que votre code fait se que voulez exactement...how bad was that.
anyway setting the dbparm without an explicit connect will not do what you think it is doing.
//you'll need a disconnect here
disconnect using sqlca;
SQLCA.dbParm = "Async = 1"
//then after setting the dbparm a reconnect to get the ASYNC parm working
connect using sqlca;
SQLCA.sp_util_maproc(ls_param)
IF SQLCA.SQLCode < 0 THEN
MessageBox(gAppNom, "Erreur :~r" + SQLCA.SQLErrText, StopSign!)
//ditto for here...if you want to go back to asynch = 0...you'll need to disconnect and reconnect.
SQLCA.dbParm = "Async = 0"
Return
END IF
However I don't think that is the issue, I'd look at the stored procedure to see if there isn't some logic that is not returning a RETURN 0.
I like your using SQLSA as a test...clever. if you go that route don't forget to test sqlca for errors.
Also we always have the stored procedures return a value 0 for success and -1 for failure so the call to the proc shoul dbe
integer ll_return
string ls_param
ll_return = SQLCA.sp_util_maproc(ls_param)
If ll_return <> 0 then
messagebox('','')
END IF
IF sqlca.sqlerrcode <> 0 then
MessageBox(gAppNom, "Erreur :~r" + SQLCA.SQLErrText, StopSign!)
end if
either way let us know the solution....
Hors ligne
Hors ligne