error using where clause

Apr 18 2011 2:29 AM
guys its really urgent ,


i have a table with two fields s_no and level

both are integers

and i m searching s_no by passing value  for level


but getting the error of datatype mismatch


 int sno = Convert.ToInt32(TextBox1.Text);
            con.Open();

            OleDbCommand cmd = new OleDbCommand("select level1 from memreg where s_no ='"+ sno + "'"  , con);
            OleDbDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Label1.Text = dr[0].ToString();


            }





Answers (4)