[thelist] search multiple tables in sqlserver

Chris Blessing webguy at mail.rit.edu
Fri Oct 4 08:33:01 CDT 2002


You need this:

Do Until rsBlah.EOF
	...
	...
	rs.MoveNext
Loop

If you don't movenext, you'll enter an infinite loop!

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net

> Using SQL Server 2000, I'm trying to search 3 different tables
> and 2 columns
> within each table for specific words.  I guess this SQL statement
> works but
> I'm having difficulty processing the return:
>
>  sqlquery = "SELECT" & _
>   " n.my_id," & _
>   " n.my_body," & _
>   " r.their_id," & _
>   " r.their_body," & _
>   " o.our_id," & _
>   " o.opinion_body" & _
>  " FROM " & _
>   " my_stuff n with(NOLOCK)," & _
>   " their_stuff r with(NOLOCK)," & _
>   " our_stuff o with(NOLOCK)" & _
>  " WHERE " & _
>   " n.my_id = r.their_id AND" & _
>   " r.their_id = o.our_id AND" & _
>   " o.our_body like '%" & sqlSearchBox & "%' or" & _
>   " n.my_body like '%" & Sqlsearchbox & "%' or" & _
>   " r.their_body like '%" & Sqlsearchbox & "%' or" & _
>   " o.our_id like '%" & sqlSearchBox & "%' or" & _
>   " n.my_id like '%" & Sqlsearchbox & "%' or" & _
>   " r.their_id like '%" & Sqlsearchbox & "%'"
>
> The ASP I'm using is:
> Do Until rsBlah.EOF
>     Response.Write "id: " & rsBlah(0)
>     Response.Write "body: " & rsBlah(1)
> Loop
>
> What's going on?
>



More information about the thelist mailing list