Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Using the like command in SQL

Reply
Thread Tools

Using the like command in SQL

 
 
MasterChief
Guest
Posts: n/a
 
      11-03-2005
I have a form that uses the POST method to call up test.asp and it
passes what is typed into the text box. Since is uses the Like command
the user can enter stuff like %Constant% to get something that is like
what the user typed in. When I call up the test.asp page it is grabbing
the text fine but isn't running the SQL command the correct way. The
SQL command ends up being

SELECT * FROM [Everyone] WHERE (Name LIKE ':: & strName & ::')

Here is my code


strName = Request.Form("Search")
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.RecordSet")
Conn.Open "PhoneList"
sSQL = "SELECT * FROM [Everyone] WHERE (Name LIKE ':: & strName & ::')"
Set Rs = Conn.Execute(sSQL)

 
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
how to enumerate a list of sql servers (isql -L like command) in Java! Remi Morin Java 0 10-23-2006 04:15 PM
object-like macro used like function-like macro Patrick Kowalzick C++ 5 03-14-2006 03:30 PM
Using the like command in SQL MasterChief ASP General 2 11-04-2005 02:44 PM
SQLConnection SQL Command SQL DataAdapter Biggie ASP .Net 1 02-06-2004 04:32 AM
distutil: how do a post-install command like create a soft link? ..or where add command to setup.py?? Christian Seberino Python 0 10-21-2003 10:29 PM



Advertisments