Try this type...
Create a variable connected with textbox then attend for sql query.
SqlCommand command = new SqlCommand("select * from icup where ID=@id", cn); command.Parameters.Add("@id", SqlDbType.Int); command.Parameters["@id"].Value = textBox1.Text;
Please mark the replies as answers if they help and unmark if they don't.