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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching a memo field for a word with ASP

Status
Not open for further replies.

artguy

Technical User
Feb 2, 2001
117
US
I am using an Access database on a web site and am pulling info from it just fine. Now I need to somehow do a search in a memo field to find a particular word. The field contains lists of counties and they are separated by commas. I enter a zip code, it finds the corresponding county and then I need to search another table to find which record contains that county.

I haven't the foggiest idea of what I'm looking for as far as a tutorial on the net or where to go for a solution for such a thing so any help or any web site that may be able to help me would be appreciated.

Thanks.

Bob
 
to search for a word in a memo field use like command:
select * ... where Field like '%TheWord%'

% is a wild card character, it means any characters can be there before and after the word...

Known is handfull, Unknown is worldfull
 
I'm afraid I don't know what to do with that command in my situation. I know little to nothing about talking with a database. I already have a dataset and I can pull stuff from it and that's it.

How can I add the command ("SELECT * FROM dealers WHERE county_covered LIKE '%" & countyName & "%'") and have it filter the results within the dataset.

Here is what I have so far without using the Select command. If you see anything too contrived or just dumb, let me know:

Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseClient
rs.Open "dealers", connStr, adOpenStatic, adLockReadOnly, adCmdTableDirect
If Not rs.EOF Then
While Not rs.EOF
If rs("state_covered") = stateCovered Then
ShowRec rs("contact")
End If
rs.MoveNext
Wend

Else
Response.Write "<p>You've requested a dealer for Zip Code " & zipreq & "</p>"
Response.Write "<p>We're sorry. That zip code is not listed in our database.</p><p>Please check your zip code or enter the zip code of another city near you.</p>"
End If

rs.Close
Set rs = Nothing
 
sql="SELECT * FROM dealers WHERE county_covered LIKE '%" & countyName & "%'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseClient
rs.Open sql, connStr
If Not rs.EOF Then
While Not rs.EOF
If rs("state_covered") = stateCovered Then
ShowRec rs("contact")
End If
rs.MoveNext
Wend



Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top