Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Pass Through Problem
Message
 
To
31/10/2005 11:10:20
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:
01063615
Views:
9
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
>
>>First, thanks everyone.
>>
>>I now have:
>>
>>
>>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
>>  (?tDateTime, ?iErrNo , ?iLineNo, ?sErrMessage, ?sLineOfCode, ?sProgram,
>>   ?sUserId, ?sAppName, ?sMemory, ?sStatus, ?sStack)
>>
>>ENDTEXT
>>
>>
>>And I'm getting prompted for values passed in as parameters
>>
>>
>>
>>
>>
>>
>>
>>
>>>>I'm trying to form an INSERT INTO string and run it:
>>>>
>>>>
>>>>sSqlCommand = "insert into syserrors "+;
>>>>  "(datetime, error, line, message, codeline, program," +;
>>>>  "user, appname, memory, status, callstack, notified)"+;
>>>>  " values "+;
>>>>  "("+ sDateTime + "," +;
>>>>  sErrNo + "," +;
>>>>  sLineNo + "," +;
>>>>  "'" + sErrMessage + "' ," +;
>>>>  "'" + sLineOfCode + "' ," +;
>>>>  "'" + sProgram + "' ," +;
>>>>  "'" + sUserId + "' ," +;
>>>>  "'" + sAppName + "' ," +;
>>>>  "'" + sMemory + "' ," +;
>>>>  "'" + sStatus + "' ," +;
>>>>  "'" + sStack + "' ," +;
>>>>"0)"
>>>>
>>>>
>>>>After running this the string looks like:
>>>>
>>>>
>>>>insert into syserrors (datetime, error, line, message, codeline, program, user, appname,
>>>>memory, status, callstack, notified)
>>>>values
>>>>(10/31/2005 07:40:27,1000,5000,'TEST MESSAGE' ,'TEST CODE LINE' ,'TEST PROGRAM' ,'KMAROIS'
>>>>,'TEST' ,'' ,'' ,'TEST STACK' ,0)
>>>>
>>>>
>>>>
>>>>SQL Server is returning the error "Incorrect syntax near '07'.
>>>>
>>>>Notice the DateTime value. It seems to be appearing as a string. Anyone know how
>>>>to solve this?
>>>
>>>Use parametric strings.
>>>
>>>text to m.sSqlCommand noshow
>>>insert into syserrors
>>>  (datetime, error, line, message, codeline, program,
>>>  user, appname, memory, status, callstack, notified)
>>>   values
>>>  (?m.sDateTime,?m.sErrNo ,?m.sLineNo, ?m.sErrMessage,... )
>>>endtext
>>>
>>>sDatetime = {^2005/10/31 07:40:27}
>>>sErrno = 1000
>>>sLineNo = 5000
>>>...
>>>
>>>SQLExec(m.lnHandle, m.sSQLCommand)
>>>
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