Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Varying results from Routine
Message
 
 
À
08/08/2007 06:38:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP3
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01246723
Message ID:
01246786
Vues:
19
This message has been marked as the solution to the initial question of the thread.
Andrew,

Please check SET ANSI status for both places. Looks like in one case you're calling with SET ANSI OFF and getting results and in the other case you're calling with the opposite setting and not getting results, since your key expression includes DTOS(datefield).

Also note, that you're not grouping, so your query would not work in VFP8 and above unless you SET ENGINEBEHAVIOR to 70.

>Hi all,
>
>I have a standard routine that I call from a number of places within our application. I have spent the afternoon trying to determine why it is returning the correct value when called from one module and why it returns an empty value when called from within a particular class. In both cases it is being called with identical parameters. I have confirmed that the parameters are identical by writing them out to a text file and examining the file in a hex editor.
>
>I suspect that the behaviour is related to the environment when the routine is called and have compared the results of the "list status to file". Besides there being a lot of other tables open when call that fails runs the SET values are the same.
>
>The code is compiled in VFP6 and has to be in order for our application to be run frm within a third party VFP6 application.
>
>The code is as below:
>
>
>LPARAMETERS tccustid, tcshipid, tcpn
>LOCAL lcConid, lnSelect, lcKey1, lcKey2, lnStart, lcExact, lcError, lcString
>
>lcError = ON("ERROR")
>ON ERROR
>lcExact = SET("EXACT")
>SET EXACT OFF
>
>lnSelect = SELECT()
>lcConid = SPACE(0)
>lnStart = SECONDS()
>
>IF TYPE("GLDEV") = "L" AND GLDEV
>	SET STEP ON
>ENDIF
>
>USE edisd SHARED AGAIN IN 0 ALIAS q_edisd
>USE edish SHARED AGAIN IN 0 ALIAS q_edish
>
>lcKey1 = PADR(ALLTRIM(tccustid),FSIZE("SH_CCODE","Q_EDISH"));
>	+PADR(ALLTRIM(tcshipid),FSIZE("SH_CSHIPID","Q_EDISH"));
>	+PADR(ALLTRIM(tcpn),FSIZE("SH_CPN","Q_EDISH"))
>
>
>lcKey2 = PADR(ALLTRIM(tccustid),FSIZE("SD_CCODE","Q_EDISD"));
>	+PADR(ALLTRIM(tcshipid),FSIZE("SD_CSHIPID","Q_EDISD"));
>	+PADR(ALLTRIM(tcpn),FSIZE("SD_CPN","Q_EDISD"))
>
>lcStatusfile = "c:\status.txt"
>IF !FILE(lcStatusfile)
>	LIST STATUS TO FILE &lcStatusfile
>ENDIF
>
>SELECT MAX(sH_dissue), sH_cPON FROM q_edish;
>	WHERE sh_ccode + sh_cshipid + sh_cpn + DTOS(sH_dissue) = lcKey1;
>	INTO CURSOR q_conid
>lcString = lcKey1 + ":" + lcKey2 + ":"
>
>IF _TALLY = 0 OR EMPTY(sH_cPON)
>	lcKey2 = PADR(ALLTRIM(tccustid),FSIZE("SD_CCODE","Q_EDISD"));
>		+PADR(ALLTRIM(tcshipid),FSIZE("SD_CSHIPID","Q_EDISD"));
>		+PADR(ALLTRIM(tcpn),FSIZE("SD_CPN","Q_EDISD"))
>	SELECT MAX(sd_dissue), sd_cran FROM q_edisd;
>		WHERE sd_ccode + sd_cshipid + sd_cpn + DTOS(sd_dissue) = lcKey2;
>		INTO CURSOR q_conid
>	IF _TALLY > 0
>		lcConid = q_conid.sd_cran
>		lcString = lcString + "by Key2" + ":"
>	ENDIF
>ELSE
>	lcString = lcString + "by Key1" + ":"
>	lcConid = q_conid.sH_cPON
>ENDIF
>
>lcString = lcString + lcConid + ":" + ALLTRIM(DBF("q_edish")) + ":" + ALLTRIM(DBF("q_edisd")) +  CHR(13)
>
>USE IN q_conid
>USE IN q_edisd
>USE IN q_edish
>
>
>=STRTOFILE(lcString,"C:\f_getconid2.txt",.T.)
>
>SET EXACT &lcExact
>ON ERROR &lcError
>
>SELECT(lnSelect)
>RETURN lcConid
>
>
>
>Any thoughts or suggestions most gratefully accepted.
>
>TIA,
>
>Andy
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform