Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Inthrutheoutdoor
Starting Member
2 Posts |
Posted - 2009-09-11 : 12:46:35
|
I'm using a stored procedure for a text search. It does work the problem is the last word of the row is what is returned, so if the row contained green apple, i could not search green to return any results, if i placed apple into the search it would return it.Is this an indexing problem?Here's all the code. ALTER PROCEDURE Search(@searchString nvarchar(100))ASSELECT GreatID, CAT_ID, CategoryID, Name, Description, KeywordsFROM GreatWHERE (Name LIKE '%' + @searchString) OR (Keywords LIKE '%' + @searchString) OR (Description LIKE '%' + @searchString) ORDER BY CAT_ID DESCRETURN} protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["searchString"] != null) { DisplaySearchResults(Request.QueryString["searchString"]); } } public void DisplaySearchResults(string strSearch) { SqlCommand cmd = new SqlCommand("Search", new SqlConnection(ConfigurationManager.ConnectionStrings["2001"].ConnectionString)); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@searchString", strSearch); cmd.Connection.Open(); RepeatGrid.DataSource = cmd.ExecuteReader(); RepeatGrid.DataBind(); cmd.Connection.Close(); cmd.Connection.Dispose(); } protected void SearchButton_Click(object sender, EventArgs e) { Response.Redirect("Search.aspx?searchString=" + Server.UrlEncode(TextBox1.Text)); } |
|
Inthrutheoutdoor
Starting Member
2 Posts |
Posted - 2009-09-11 : 16:51:52
|
this is certainly not the first time trust me!!! that i answer my own dang questionAnd i'm posting it in the event others need this answerWHERE (Name LIKE '%' + @searchString + + '%') OR |
|
|
|
|
|
|
|