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);
cn.Open();
SqlCommand cmd = new SqlCommand(sqlvar,cn );
i = cmd.ExecuteNonQuery();
if (i > 0)
{
MessageBox.Show("cmd executed");
}
else
{
MessageBox.Show("not executed");
}
}