ADO.NET

ADO.NET Projects

ADO.NET Project 1

ADO.NET Examples

Examples

Connecting to MS Access Database in ASP .NET
Previous Home Next

Code for Connecting to Access

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page 
{
protected void Page_Load(object sender, EventArgs e)
{   
//Connection String
OleDbConnection NewConnection = new
OleDbConnection
(@"Provider=Microsft.Jet.OLEDB.4.0; Data Source = c:\newDtabse.mdb");
NewConnection.Open();   //Connection Open 
}
}

 

newDtabse.mdb is the name of database.

How to know about your OleDBConnection
public partial class _Default : System.Web.UI.Page 
{
protected void Page_Load(object sender, EventArgs e)
{
OleDbConnection NewConnection = new
OleDbConnection
(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source = D:\newDtabse.mdb");
NewConnection.Open();
Label1.Text = NewConnection.State.ToString();
Label2.Text = NewConnection.ServerVersion.ToString();
Label3.Text = NewConnection.Provider.ToString();
}
}

emp_tbl table data show in a gridview.

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: