Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange Error Message
Message
 
 
À
25/03/2011 11:54:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01504918
Message ID:
01505000
Vues:
58
By quick examining of the code I don't see a way of lnResult to not having a value.

The suggestion of Parameters to lparameters is mostly because it's always better to define variables and parameters with local scope if you don't want to re-use them.

>>Change PARAMETERS to LPARAMETERS
>
>Why should that have any impact?
>
>
>>and add
>>
>>LOCAL lnResult
>>lnResult = 0
>
>I've already modified the program like this and am waiting to see if it has any impact.
>
>But my main question remains...........
>
>What conditions could possibly cause either
>
>1. lnResult does not get assigned
>
>OR
>
>2. SQLEXEC() would return -1 without setting up the appropriate values for AERROR()
>
>
>
>
>
>
>
>
>
>>
>>at the top of your code
>>
>>>I have the following code
>>>
>>>*sql_execute
>>>PARAMETERS tnConnection,tcSql,tcOutput
>>>
>>>IF EMPTY(tcSql)  && Processing via an SQLPREPARE() statement
>>>	tcSql = " "   && So Error Routine has character value
>>>	lnResult = SQLEXEC(tnConnection)
>>>ELSE
>>>	IF EMPTY(tcOutput)
>>>		lnResult = SQLEXEC(tnConnection,tcSql)
>>>	ELSE
>>>		lnResult = SQLEXEC(tnConnection,tcSql,tcOutput)
>>>	ENDIF
>>>ENDIF
>>>
>>>IF lnResult = -1 
>>>	=AERROR(aTmpError)
>>>	lnStack = ASTACKINFO(aTmpStack)
>>>
>>>	IF TYPE("app_global") <> "O"
>>>		app_global = CREATEOBJECT('custom')
>>>		app_global.addproperty("app_name","Insert App Name")
>>>		app_global.addproperty("employee","RPUPKO")
>>>	ENDIF
>>>		
>>>	INSERT INTO spotlight_errors(application,sql_statement,error_msg,dt_error,userid,stack) VALUES;
>>>	    (app_global.app_name,tcSql,aTmpError[2],DATETIME(),app_global.employee,this.array_to_char('aTmpStack'))
>>>	USE IN (SELECT('spotlight_errors'))
>>>
>>>	IF this.showerror
>>>		=MESSAGEBOX(aTmpError[2],0,PROGRAM(aTmpStack[ALEN(aTmpStack,1)-1,1]))
>>>		SET STEP ON 
>>>	ENDIF
>>>	RETURN .F.
>>>ENDIF
>>>
>>>One of the records in the error log has the error message Variable 'LNRESULT' is not found."
>>>
>>>I've never been able to reproduce this error and it's quite possible that the environment would actually absorb it and allow processing to continue. So if this error were generated by IF lnResult = -1 the record would actually get written.
>>>
>>>What I don't understand is how the variable could not have a value. Can anybody give me a set of circumstances where this variable does not exist when AERROR() is called?
>>>
>>>One possibility is that the error was actually generated in some other module and properly handled there. It could have been the last error generated so that's what AERROR() would find. In which case, for this module it really has a value of -1 so I'm supposed to go into the error handling portion of the code. The problem with that is the value is being assigned by the SQLEXEC() statements. If that statement resulted in a value of -1, why doesn't AERROR() return the ODBC errors I'm expecting.
>>>
>>>I've checked with the users of the system and nobody has noticed any unexpected results, so it appears that the final processing is correct. But this is driving me crazy(ier). Any and all suggestions gratefully accepted.
>>>
>>>..........Rich
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