SELECT .... LIKE doesn't work

G

Guest

String cstr = "select * from tFam where name like \'" + tFind.Text + "\' order by name, fname"

Directed to Access DB
Works fine when tFind.Text = "nelson" but returns nothing when tFind.Text = "*son". Same behavior with single or double quotes around the find text. What's up

Thanks
Eric
 
G

Guest

OK, so where was I supposed to find out it's the PERCENT sign for wildcard with OleDb??
It's the splat (*) in Access!

Is there an OleDb equivalent to the (?) in Access, i.e. match one character

Sigh..

Eric
 
K

kdub

I think its basic TSQL. MS Access uses its own flavor of Structured Query
Language Syntax.

Just a tip:

single quotes and + sign is how you concatenate strings.

'hello ' + 'world.'
 
J

JLW

That's TSQL-99 language. I _ (Underscore) is wild for one charactor, but
what if you needed to find everything that started with Tre? Use Like
'Tre%'. You can download the SQL Server Books On-line, it's a great
reference and you don't have to have SQL server installed to use the BOL

HTH
JLW
Eric Nelson said:
String cstr = "select * from tFam where name like \'" + tFind.Text + "\' order by name, fname";

Directed to Access DB.
Works fine when tFind.Text = "nelson" but returns nothing when tFind.Text
= "*son". Same behavior with single or double quotes around the find text.
What's up?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top