SELECT WITH VARIABLE
-
I have a variable called "testvar" with a value of (let's say)OPT My SQL SELECT statement I have this "SELECT FROM PRICELIST WHERE CAT =" &TESTVAR Or something like this. IF I change the testvar in the select to "OPT" it works but not if just OPT.. How do I get my TESTVAR sert to hav the guotes in allready. ????? I KNOW it must be something silly? PLEASE? I assign the testvar="OPT" but need the select statement to then add this corectly to do a = to OPT? HOPE this is enough info. (P.S. yes I am a newby as you can see :) evlxtc
-
I have a variable called "testvar" with a value of (let's say)OPT My SQL SELECT statement I have this "SELECT FROM PRICELIST WHERE CAT =" &TESTVAR Or something like this. IF I change the testvar in the select to "OPT" it works but not if just OPT.. How do I get my TESTVAR sert to hav the guotes in allready. ????? I KNOW it must be something silly? PLEASE? I assign the testvar="OPT" but need the select statement to then add this corectly to do a = to OPT? HOPE this is enough info. (P.S. yes I am a newby as you can see :) evlxtc
-
You have to put apostrophes around the string value:
"SELECT FROM PRICELIST WHERE CAT = '" & TESTVAR & "'"
This will give you a string that contains:SELECT FROM PRICELIST WHERE CAT = 'OPT'
--- b { font-weight: normal; } -
Thanks, that is all I needed. :)NOW I just need to finish a few small graphics and that will be that for this site. :) PS How do I in anycase concat a string to make a variable = "something" or is this not possible straight forward? this is me