Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8313085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:22:43+00:00 2026-06-08T20:22:43+00:00

I have very odd problem and I don’t know how to get rid of

  • 0

I have very odd problem and I don’t know how to get rid of this.

I have one advance search for my project, its basically school search

acc my problem is I am using LIKE to compare the option and at the end of the search my query should be like this below:

select *
from tbl_schooldetails
where
  state = 'Gujarat'
  and city = 'Ahmedabad'
  and area = 'Navrangpura'
  and ( board = 'xx' or board LIKE '%CBSE Board%' or board LIKE '%Gujarat Board%')

but instead I get this below query:

select *
from tbl_schooldetails
where
  state = 'Gujarat'
  and city = 'Ahmedabad'
  and area = 'Navrangpura'
  and ( board = 'xx' or board LIKE '�SE Board%' or board LIKE '%Gujarat Board%')

If you noticed my %CB is converted into ” � ” sign and so i am not able to search any result related to “CBSE Board” option.

Can anyone tell me how to get rid of this URL encoding?

this is my code from where this query is generated:

  string qry = "select * from tbl_schooldetails where state = '" + sdpd4.SelectedItem.Text + "'";

    if (sdpd2.SelectedItem.Text != "Select City")
    {
        qry += " and city = '" + sdpd2.SelectedItem.Text + "'";
    }

    if (sdpd1.SelectedItem.Text != "Select Area")
    {
        qry += " and area = '" + sdpd1.SelectedItem.Text + "'";
    }

    if (CheckBoxList3.SelectedItem != null)
    {
        qry = qry + " and ( board = 'xx'";

          for (int i = CheckBoxList3.Items.Count - 1; i >= 0; i--)
          {
              if (CheckBoxList3.Items[i].Selected == true)
              {

                  string mt = CheckBoxList3.Items[i].ToString();
                  qry = qry + " or board LIKE '" + '%' + mt + '%' + "'";

              }
          }
            qry = qry + ")";
    }


    if (RadioButtonList1.SelectedItem != null)
    {
        qry += " and gender ='" + RadioButtonList1.SelectedItem.Text + "'";
    }



    Response.Redirect("schoolsearchresult2.aspx?search=" + qry);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:22:44+00:00Added an answer on June 8, 2026 at 8:22 pm

    Edited now that the original question is clearer.

    Just change this:

    Response.Redirect("schoolsearchresult2.aspx?search=" + qry);
    

    To this:

    Response.Redirect("schoolsearchresult2.aspx?search=" 
        + HttpServerUtility.UrlEncode(qry));
    

    …but: my warning (and everybody else’s) remains correct: passing a WHERE clause in your query string is very dangerous–trivial tweaking of the resulting URL can destroy your database.

    Original answer

    You seem to be putting %CB into a URL, which is interpreted on the server as a hex digit.

    If you use %25CB it should be interpreted as “%CB”.

    Alternatively you could use one of the built-in c# functions. I think the one you need is HttpServerUtility.UrlEncode.

    VERY IMPORTANT:

    If this is a real application, not a proof-of-concept project, you must not copy data directly from the URL into your SQL string!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first question on S.O. I have a very odd problem. Below
This is very odd. I have never had this issue with ShowDialog in C#.
i have very serious problem if any tech expert can help...thank you in advance..
I have a very odd problem. A class property is mysteriously reset between method
We have a very odd problem here with SVN. Let me first explain the
I have a very odd problem with unobtrusive validation. I have a model with
I have a very odd problem with javascript. My code is rather long so
Very odd problem as this is working perfectly on our old Classic ASP site.
I've been experiencing this very odd problem lately in Heroku. I develop and test
I seem to be having a very odd problem with my iPhone project in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.