Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 4th, 2007, 11:21 AM
Authorized User
 
Join Date: Mar 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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]">
            <SelectParameters>
                <asp:QueryStringParameter Name="CompName" QueryStringField="cn" Type="String" />
                <asp:QueryStringParameter Name="CompName2" QueryStringField="cn" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Expected values in a condition, XPath 1.0 akentanaka XSLT 2 June 27th, 2008 05:48 AM
Search Condition tmadhavi SQL Server 2000 2 February 21st, 2008 03:13 AM
NEWBIE Question: Expected "" in search condition aasiddle SQL Language 5 March 19th, 2007 03:49 PM
Help PLZ..Condition for Search Page shopgirl Classic ASP Databases 4 April 5th, 2004 10:59 PM
WHERE BETWEEN search condition in sproc jtyson SQL Server 2000 1 August 7th, 2003 09:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.