Friday, February 17, 2012

Delete data from MS access Database using ASP.Net

This program will delete data from MS access database

Before  Delete:-




After Delete:-





using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Data.SqlClient;
using System.Data.Odbc;
using System.Data.OleDb;

public partial class oledb : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


        OleDbConnection objConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=D:\\mydb.mdb;");

        OleDbCommand objCmd = new OleDbCommand("delete from stud where id=200", objConn);
        OleDbDataReader objReader;
        objConn.Open();
        objReader = objCmd.ExecuteReader();
               
        objConn.Close();

       
    }
}

No comments:

Post a Comment