Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Search

Status
Not open for further replies.

timdodgson

Technical User
Jun 12, 2000
111
GB
Hi i am trying to run a search against a access database the the field is a memo field when i run this against the field

strSQL = "SELECT * " _
& "FROM [qualtexm] " _
& "WHERE t LIKE '%" & Replace(strSearch, "", " %") & "%' " _
& "ORDER BY id;"

if i do a single word search it works ok but if i seach for two words it will only find them as a pair i just want to find any instance of them

Many Thanks in advance

Please be patient with me this is only my third week coding asp and i am using google as my teacher


Tim Dodgson
 
Tim

Try something like this:
Code:
strSQL = "SELECT * FROM [qualtexm] WHERE t LIKE '%" & word1 & "%" word2 & "%' ORDER BY id;"

~Satish

 
Thanks for the reply but wot i forgot to say was i am trtying to get both words from one txt box any more help would be apprectated

Many Thanks
Tim
 
OK then if the words are separated by a space, replace(like you are doing for the double quotes in your example) the spaces with %. So it you have "ASP Forums" use the replace function to make it "ASP%Forums". That should do it.

 
Thank you so much the querry ended up at as this

strSQL = "SELECT * " _
& "FROM [qualtexm] " _
& "WHERE t LIKE '%" & Replace(strSearch, " ", "%") & "%' " _
& "ORDER BY id;"

I have one more question how do i get pictures to show that are embeded in the database
Again M any Thanks in advance

Tim Dodgson
 
I really don't know but from I've been advised not to store images in the database. Store them in a folder and the name in the database.

 
Thanks fotr all your help the prob i have is i am working with an exsting datbase that hasa 5k pictures any way thanks again

As always 2 steps forward and 1 back lol

Tim Dodgson
 
i think you need to do a

Response.BinaryWrite for the images...

-DNG
 
I don't know if it is the same in Access, but in T-SQL you have to put the BLOB/image field at the end of the query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top