hiiiiiiiii evryone,
plz help me out.i want to delete a record but not able to do so.plz check the code and rectify the mistake.it is giving some unknown error.thnqqq

private void button1_Click(object sender, EventArgs e)
            int i;
          String  sqlvar =("Delete from emp where empno=" + textBox1.text);

          string conn1 = "Data Source=(local);" +
  "Initial Catalog=master;" +
  "Integrated Security=SSPI";
            SqlConnection cn=new SqlConnection(conn1);
            SqlCommand cmd = new SqlCommand(sqlvar,cn );
            i = cmd.ExecuteNonQuery();
            if (i > 0)
                MessageBox.Show("cmd executed");
                MessageBox.Show("not executed");


Can you write back exact error message u get... with full description..


and at which line (just to be sure)

Make sure your catalog is set to the correct database. Currently it is set to master which is the primary system database.