advance search - url encoding
<p>I have very odd problem and I don't know how to get rid of this.</p>

<p>I have one advance search for my project, its basically school search</p>

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

<pre><code>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%')
</code></pre>

<p>but instead I get this below query:</p>

<pre><code>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%')
</code></pre>

<p>If you noticed my <code>%CB</code> is converted into " � " sign and so i am not able to search any result related to "CBSE Board" option.</p>

<p>Can anyone tell me how to get rid of this URL encoding?</p>

<p>this is my code from where this query is generated:</p>

<pre><code>  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 &gt;= 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);
</code></pre>
