NEWBIE Question: Expected "" in search condition
Hello people and many thanks for taking the time to read this. I have the following problem and cant seem to find the answer anywhere.
I have a search page and a results page. The search page appends a query string to the url and the results page takes the query and does a search on the sql database. Now this is fine if I just enter 1 word but if I enter two words such as "West Kington" it produces the error in the title. If I do a manual search entering the quotes it works fine. How do I go about appending the quotes to the search?
Many thanks again
Protected Sub CN_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CN.Click
Response.Redirect("results.aspx?cn=" + TextBox1.Text)
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ListingDBConnectionString %>"
SelectCommand="SELECT [CompName], [Town], [Tele] FROM [CompanyDetails] WHERE (([CompName] = @CompName) OR (CONTAINS([CompName], @CompName2))) ORDER BY [CompName]">
<asp:QueryStringParameter Name="CompName" QueryStringField="cn" Type="String" />
<asp:QueryStringParameter Name="CompName2" QueryStringField="cn" Type="String" />