Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Pass Through Problem
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01063586
Message ID:
01063719
Views:
10
>Ok, I see. Thanks
>
>I'm open to suggestion on the best way to do this.
>
>
I think the easiest was is to make them PRIVATE rather than LOCAL so they are still in scope. There are plenty of potential problems with this if you re-use those names further down the calling tree (as a 2.6 dinosaur I coded around these problems as a normal practice)

There are probably better solutions involving gathering all the items to be insertted into an array or object and passing that to ._oSQLProcs.SQLCommand(sSqlCommand,@aValues). You would have to add the new parameter to the SQLCommand method and, to avoid breaking your current code, add code to check for aValues and run the old code if it's not there and run the new code if it is. Depending on how complex .SQLComman is this could be simple or impossible.

My 2 cents.........Rich


>
>
>>The parameters are local and will not be visible outside the method they are defined.
>>
>>>Here is the code for the entire function. All paramter variables being passed
>>>to SQL contained values when I ran it.
>>>
>>>
>>>PROCEDURE HandleError(sAppName AS String, iErrNo AS Integer,;
>>>                      sErrMessage AS String, sLineOfCode AS String,;
>>>	              sProgram AS String, iLineNo AS int, sStack AS String)
>>>	
>>>  LOCAL iRetVal, sDateTime, sErrNo, sLineNo, sUserId, sMemory, sStatus
>>>  LOCAL sSqlCommand
>>>
>>>  iRetVal = TRUE
>>>
>>>  WITH This
>>>		
>>>    ** Setup the connection
>>>    IF .Setup()
>>>
>>>      tDateTime = DATETIME()
>>>      sUserId   = UPPER(ALLTRIM(SUBSTR(SYS(0), AT("#", SYS(0))+1)))
>>>
>>>      TEXT TO sSqlCommand NOSHOW
>>>
>>>        insert into syserrors
>>>	  (datetime, error, line, message, codeline, program,
>>>	   [user], appname)
>>>	values
>>>	  (?tDateTime, ?iErrNo , ?iLineNo, ?sErrMessage, ?sLineOfCode,
>>>           ?sProgram, ?sUserId, ?sAppName)
>>>
>>>      ENDTEXT
>>>
>>>
>>>** Just added this code. Still prompted me for values
>>>tDateTime   = DATETIME()
>>>sUserId	    = UPPER(ALLTRIM(SUBSTR(SYS(0), AT("#", SYS(0))+1)))
>>>iErrNo 	    = 1
>>>iLineNo     = 2
>>>sErrMessage = "Some message"
>>>sLineOfCode = "Some code"
>>>sProgram    = "Some program"
>>>sAppName    = "Some app name"
>>>
>>>
>>>      ** Run the insert command
>>>      ._oSQLProcs.SQLCommand(sSqlCommand)
>>>
>>>      ** Check for and handle any errors that occured
>>>      ._CheckForSQLError()
>>>
>>>    ENDIF
>>>		
>>>  ENDWITH
>>>	
>>>RETURN
>>>	
>>>ENDPROC
>>>
>>>
>>>
Previous
Reply
Map
View

Click here to load this message in the networking platform