Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Pass Through Problem
Message
 
To
31/10/2005 11:14:29
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01063586
Message ID:
01063631
Views:
8
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
>Are you sure? I didn't see all in code. It asks for those missing only. Please do not forget to prefix with m. or alias,object name (if from a cursor, object).
>Cetin
>
>>All variables are filled in already. I'm getting prompted for
>>parameter values.
>>
>>
>>>Great they already are coming as parameters:)
>>>Fill in those that aren't passed as parameters before call to SQLExec().
>>>
>>>PROCEDURE HandleError(sAppName AS String, iErrNo AS Integer,;
>>>                      sErrMessage AS String, sLineOfCode AS String,;
>>>	              sProgram AS String, iLineNo AS int, sStack AS String)
>>>TEXT TO sSqlCommand NOSHOW
>>>  insert into syserrors
>>>  (datetime, error, line, message, codeline, program,
>>>  [user], appname, memory, status, callstack)
>>>  values
>>>  (?m.tDateTime, ?m.iErrNo , ?m.iLineNo, ?m.sErrMessage, ?m.sLineOfCode, ?m.sProgram,
>>>   ?m.sUserId, ?m.sAppName, ?sMemory, ?sStatus, ?sStack)
>>>ENDTEXT
>>>tDateTime = datetime() && Any valid VFP date/datetime expression
>>>sUserId = 'whoever'
>>>sMemory = 'whatever'
>>>sStatus = 'yourstatus'
>>>SQLExec(...)
>>>
Cetin
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform