Where clause

E

eyoung

sSQL = "SELECT *" & _
" FROM 06_Statements" & _
" WHERE [Billing Date] = '23-DEC-2005'" & _
" And [Total Charge] > 0" & _
" AND Description LIKE'Cellular" & "*" & "'" & _
" ORDER BY [Service Number]"
set rs = Connect.Execute(sSQL)

Can someone tell me what's wrong wth this?
" AND Description LIKE'Cellular" & "*" & "'" & _

I've also tried
" AND Description LIKE'Cellular*'" & _
as well as other versions.

This works find but I need to grab other things with "Cellular" in
them.
" AND Description LIKE'Cellular Roaming Charges'" & _
 
B

Bob Barrows [MVP]

sSQL = "SELECT *" & _
" FROM 06_Statements" & _
" WHERE [Billing Date] = '23-DEC-2005'" & _
" And [Total Charge] > 0" & _
" AND Description LIKE'Cellular" & "*" & "'" & _
" ORDER BY [Service Number]"
set rs = Connect.Execute(sSQL)

Can someone tell me what's wrong wth this?
" AND Description LIKE'Cellular" & "*" & "'" & _

I've also tried
" AND Description LIKE'Cellular*'" & _
as well as other versions.

This works find but I need to grab other things with "Cellular" in
them.
" AND Description LIKE'Cellular Roaming Charges'" & _


When running queries via ADO, you must use ODBC wildcards (% and _) instead
of (* and ?) regardless of what database backend you are using.

Having said that, your use of dynamic sql is leaving you open to hackers
using sql injection as well as performance impairment. You should consider
using parameters instead:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e
 

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

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top