i have using this code for searching in datagridview
dataGridView1.Rows.Clear();
SqlCommand cmd = new SqlCommand("select * from enquery where sname='" + textBox1.Text + "' or contectno='" + textBox1.Text + "' or courese='" + textBox1.Text + "'or remark='" + textBox1.Text + "' or edate='" + textBox1.Text + "' or id='" + textBox1.Text + "' or fudate='" + textBox1.Text + "' or fustatus='" + textBox1.Text + "' or cancel='" + textBox1.Text + "' ", con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
object[] row = { dr[0], dr[1], dr[2], dr[3], dr[4], dr[5], dr[6], dr[7], dr[8] };
dataGridView1.Rows.Add(row);
}
con.Close();
this code is working if all the field in sql are same datatype but not working if those field are different data type , example sname is varchar contectno is bigint so it show exception , can anybody help me short out this problum.i have only one textbox and user can search by any field.