Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

Write a program to Delete Record in ASP.NET ? 

OleDbConnection x;
    OleDbCommand y;
     protected void Button1_Click(object sender, EventArgs e)
    {
        x = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=c:\db1.mdb");
        x.Open();
        y = new OleDbCommand("delete from emp where empno=@p",x);
        y.Parameters.Add("@p", TextBox1.Text);
        y.ExecuteNonQuery();
        Label1.Visible = true;   
        Label1.Text="Record Deleted";
        y.Dispose();
        x.Close(); 
 }