>when inserting date or logical value using SQL Passthrough, these generate error:
>?sqlexec(nHandle,'INSERT INTO X (date) values ({01/01/2005})')
>?sqlexec(nHandle,'INSERT INTO X (Boolfield) values (.t.)')
>
>what are the equivalent date representation such as:
>VFP: {01/01/2005}
>MSSQL: '01/01/2005' ?
>FIREBIRD: ?
>or logical 'true' representation such as
>VFP: .t.
>MSSQL: ?
>FIREBIRD:?
>
>?sqlexec(nHandle,'SELECT * from X where boolfied=.t.') &&error
>?sqlexec(nHandle,'SELECT * from X where .f.') &&to just get the structure
You don't need to know how to handle them per backend. VFP does that for you. However for SQL server they're like:
VFP: {01/01/2005}
MSSQL: '2005/01/01 00:00:00' && ODBC canonical format-other formats possible
VFP: .t.
MSSQL: 1
Easy way to handle is to use parameters instead:
myDate = {^2005/01/01}
myBool = .t.
?sqlexec(nHandle,'INSERT INTO X (date) values (?m.myDate)')
?sqlexec(nHandle,'INSERT INTO X (Boolfield) values (?m.myBool)')
PS: I assume you're not using keywords as column names or using quoted identifiers.
Update: Missed select commands at the end:
m.myBool = .t.
?sqlexec(nHandle,'SELECT * from X where boolfied=?m.myBool','myCursor')
?sqlexec(nHandle,'SELECT * from X where 1=0')
Cetin