Welcome! Log In Create A New Profile

Advanced

SELECT STATEMENT WITH WHERE ACTIONS

Posted by Mitchell 
Mitchell
SELECT STATEMENT WITH WHERE ACTIONS
June 08, 2008 01:07PM
dear coders,
how to make this line working?

// note : edtitemcode is some other value like '4041218'
xval = edtitemcode
sSqlText is string = "SELECT ST_ITEM.ITEM_CODE FROM ST_ITEM WHERE ST_ITEM. ITEM_CODE =@xval"

my question is : how to make a SELECT statement using a WHERE to the variable, like xval.

help please.

regards
mikz
cardcoder
Re: SELECT STATEMENT WITH WHERE ACTIONS
June 08, 2008 02:02PM
Hi Mitchell,

Try This

xval = edtitemcode

sSqlText is string = "SELECT ST_ITEM.ITEM_CODE FROM ST_ITEM WHERE ST_ITEM. ITEM_CODE = "+xval

That should work.

The + adds the variable into the string. You can add other items as well e.g
= "+xval+" OR ST_ITEM. ITEM_CODE =""+yval

(you get the idea)

Mike
www.fbs-ltd.co.uk
Mitchell
Re: SELECT STATEMENT WITH WHERE ACTIONS
June 08, 2008 02:31PM
thanks a lot mike,
it works now with the one you suggest :

sSqlText is string ="SELECT ST_ITEM.ITEM_CODE FROM ST_ITEM WHERE ST_ITEM. ITEM_CODE = "+xval

hayyyyyyyyyyy


thanks again

god bless u.
Ben
Re: SELECT STATEMENT WITH WHERE ACTIONS
June 08, 2008 03:24PM
Just note, if you're searching a string, the last part:
ITEM_CODE = "+xval
Should be:-
ITEM_CODE = '"+xval + "'"
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: