Is there a way to include/inject variable within TEXT INTO?
Example
- Code: Select all Expand view
cVar := 'Spain'
TEXT INTO cSql
SELECT * FROM table WHERE country = cVar
ENDTEXT
cVar := 'Spain'
TEXT INTO cSql
SELECT * FROM table WHERE country = cVar
ENDTEXT
var := "'Spain'"
TEXT INTO cSQL
select * from table where country = <<var>>
ENDTEXT
SELECT * FROM table WHERE country = 'Spain'
SELECT * FROM table WHERE country = <<var>>
fraxzi wrote:
I tried:
- Code: Select all Expand view
var := "'Spain'"
TEXT INTO cSQL
select * from table where country = <<var>>
ENDTEXT
ps. I have not tested.
The result should be:
- Code: Select all Expand view
SELECT * FROM table WHERE country = 'Spain'
but I got:
- Code: Select all Expand view
SELECT * FROM table WHERE country = <<var>>
var := "'Spain'"
TEXT INTO cSQL
select * from table where country = $1
ENDTEXT
cSQL:= Expand( cSQL, Var )
TEXT INTO cSql
SELECT Column1
FROM myTable
WHERE Column2 = ?
ENDTEXT
nMyVar:=1
cSql := FW_AdoApplyParams( cSql, { nMyVar } )
fraxzi wrote:Hi All,
Is there a way to include/inject variable within TEXT INTO?
Example
- Code: Select all Expand view
cVar := 'Spain'
TEXT INTO cSql
SELECT * FROM table WHERE country = cVar
ENDTEXT
PRIVATE cVar := "'Spain'" // do not declare cVar as local
TEXT INTO cSql
SELECT * FROM table WHERE country = &cVar
ENDTEXT
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 76 guests