By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,207 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,207 IT Pros & Developers. It's quick & easy.

Inserting Variable into SQL LIKE Statement

devonknows
100+
P: 137
ok im having real trouble deciding on were this goes, as its programming in Visual Basic, but its an SQL command im having the trouble with, so im gonna do both <grins>

Ok, i have an SQL statements like so -

statement = "SELECT Albumname, DIR, Mix FROM BonkersListAndDir WHERE Albumname LIKE '' ORDER BY Albumname"

but i need to insert the data from a variable named "text" into were the LIKE is and nothing i do seems to working, ive treid

LIKE '' & Text
LIKE Text & ''
LIKE ' & Text & '

but cant seem to get it in, if anyone would be kind enough to show me how to rectify this problem will be most greatful, thank

Devon.
Nov 30 '06 #1
Share this Question
Share on Google+
1 Reply


ronverdonk
Expert 2.5K+
P: 4,258
This is a Visual Baic question about inserting a variable into a text string, which happens to be an SQL query string.

I will re-route this thread to the VB forum.

Ronald :cool:
Nov 30 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.