What I am trying to do is have a user enter a word into a text box and retrieve the information from a SQL database where the 'entered word' eqauls that a column. I have this working perfectly but now I would like the user to be able to enter multiple words to search for. The trouble I'm having is that it's looking for all of the words in a single entry.
Here is my vb.net code to pass the textbox entry to the stored procedure:
Session("Suburb") = TbSuburbs.Text Dim parameterSuburb As SqlParameter = New SqlParameter("@suburb", SqlDbType.VarChar, 50) parameterSuburb.Value = Session("Suburb") myCommand.SelectCommand.Parameters.Add(parameterSuburb)
And the stored procedure
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[Search_Realestate] ( @RegID as varchar(50), @category as varchar(50), @price_min as int, @price_max as int, @bed as varchar(50), @car as varchar(50), @bath as varchar(50), @suburb as varchar(100) ) as select headline as headline, subNumber as subNumber, streetNumber as streetNumber, street as street, suburb as suburb, '$' + convert (varchar (50),price,105) as price, bedrooms as bedrooms, bathrooms as bathrooms, garages as garages, description as description, image1 as URL1, category as category, Ref_No as RefNo, Rowguid from Realestate Where @RegID = 'Admin' and category = @category and price >= @price_min and price <= @price_max and bedrooms >= @bed and bathrooms >= @bath and garages >= @car and suburb LIKE @suburb
So any help with this would be great. I would like to eventually like to give the textbox an auto complete element to it, so if you know any good tutorials for that I would appreciate it.