BONIETTE
BONIETTE

Reputation: 27

select query in foxpro

I'm trying this

col= thisform.combo4.DisplayValue+SUBSTR(thisform.combo3.DisplayValue,1,3)
SELECT col as a1 FROM doc WHERE com=thisform.combo1.DisplayValue INTO CURSOR c1
thisform.text30.Value=c1.a1

The variable col represent the name of column in the dbf
It results the name of the column not the value stored in that column

Upvotes: 0

Views: 2332

Answers (1)

Cetin Basoz
Cetin Basoz

Reputation: 23797

col= thisform.combo4.DisplayValue+SUBSTR(thisform.combo3.DisplayValue,1,3)

* here I assume col is a correct string that represents an existing column


SELECT &col as a1 FROM doc ;
  WHERE com=thisform.combo1.DisplayValue ;
  INTO CURSOR c1 ;
  nofilter
thisform.text30.Value=c1.a1

IOW to be able to use a string in a Select for a column name, you need to use & (macro substition) operator.

Upvotes: 4

Related Questions