Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Where clause

Reply
Thread Tools

Where clause

 
 
eyoung@ncsa.uiuc.edu
Guest
Posts: n/a
 
      02-07-2006
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'" & _

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      02-07-2006
wrote:
> 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/...e36562fee7804e
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
use clause crazyrdx VHDL 1 08-30-2005 01:32 PM
"else process" clause bxbxb3 VHDL 3 05-27-2005 11:41 AM
Re: Santa Clause like you have never seen him before Jeff Griffin Wireless Networking 0 12-29-2004 02:28 PM
Quartus II error - use clause error... - very strange behaviour Jan VHDL 2 12-16-2004 03:33 PM
Re: Formatting string in WHERE clause Lee Simpson ASP .Net 0 07-18-2003 04:21 PM



Advertisments