Error converting data type varchar to float on populating GridView
<p>I am populating the GridView with following code on basis of Numeric data put in the textbox and clicking the button.
But it is giving the following error.
Error converting data type varchar to float. 
As my database column 'matri_perct' has datatype 'float'.</p>

<pre><code>protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            con = new SqlConnection(ConfigurationManager.ConnectionStrings["SQL Connection String"].ConnectionString);con.Open();
        com = new SqlCommand("SELECT * FROM stdtable WHERE matri_perct &gt;  @Percent", con);
        com.Parameters.AddWithValue("Percent", float.Parse(txtPercent.Text));
        com.ExecuteNonQuery();
            SqlDataAdapter dataadapter = new SqlDataAdapter();
            DataSet ds = new DataSet();
            dataadapter.Fill(ds, "Data");
            GridView1.DataSource = ds;
            GridView1.DataMember = "Data";
            con.Close();
        }
        catch (System.Exception err)
        {
            Label1.Text = err.Message.ToString();
        }
    }
</code></pre>

<p>My GridView .aspx code is declared as </p>

<pre><code>&lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="univ_regno" DataSourceID="" EnableModelValidation="True"&gt;
    &lt;Columns&gt;
        &lt;asp:BoundField DataField="school" HeaderText="School" 
            SortExpression="school" /&gt;
        &lt;asp:BoundField DataField="univ_regno" HeaderText="Univ R.No." ReadOnly="True" 
            SortExpression="univ_regno" /&gt;
        &lt;asp:BoundField DataField="colge_rollno" HeaderText="Coll. R.No." 
            SortExpression="colge_rollno" /&gt;
        &lt;asp:BoundField DataField="branch" HeaderText="Branch" 
            SortExpression="branch" /&gt;
        &lt;asp:BoundField DataField="sem" HeaderText="Sem" SortExpression="sem" /&gt;
        &lt;asp:BoundField DataField="name" HeaderText="Name" SortExpression="name" /&gt;
        &lt;asp:BoundField DataField="f_name" HeaderText="F.Name" 
            SortExpression="f_name" /&gt;
        &lt;asp:BoundField DataField="date_birth" HeaderText="DOB" 
            SortExpression="date_birth" /&gt;

        &lt;asp:BoundField DataField="mob" HeaderText="Mobile" 
            SortExpression="mob" /&gt;
        &lt;asp:BoundField DataField="email" HeaderText="E-mail" SortExpression="email" /&gt;
        &lt;asp:BoundField DataField="matri_perct" HeaderText="Matric %" 
            SortExpression="matri_perct" /&gt;
        &lt;asp:BoundField DataField="intermed_perct" HeaderText="Intermediate %" 
            SortExpression="intermed_perct" /&gt;
        &lt;asp:BoundField DataField="grad_perct" HeaderText="UG %" 
            SortExpression="grad_perct" /&gt;
        &lt;asp:BoundField DataField="post_grad_perct" HeaderText="PG %" 
            SortExpression="post_grad_perct" /&gt;
        &lt;asp:BoundField DataField="other_perct" HeaderText="Other %" 
            SortExpression="other_perct" /&gt;
        &lt;asp:BoundField DataField="no_backlogs" HeaderText="Backlogs" 
            SortExpression="no_backlogs" /&gt;
        &lt;asp:BoundField DataField="Password" HeaderText="Password" 
            SortExpression="Password" /&gt;
    &lt;/Columns&gt;
&lt;/asp:GridView&gt;
  &lt;asp:SqlDataSource ID="studentprofile" runat="server" 
        ConnectionString="&lt;%$ ConnectionStrings:SQL Connection String %&gt;" 

        SelectCommand="SELECT DISTINCT [school], [univ_regno], [colge_rollno], [branch], [sem], [name], [f_name], [date_birth], [cores_add], [mob], [email], [matri_perct], [intermed_perct], [grad_perct], [post_grad_perct], [other_perct], [no_backlogs], [Password] FROM [stdtable] ORDER BY [branch], [univ_regno]"&gt;
    &lt;/asp:SqlDataSource&gt;
</code></pre>
