Live Chat Icon For mobile
Live Chat Icon

How to use OleDb DataSet

Platform: ASP.NET| Category: ADO.NET

Use namespace System.Data.OleDb

VB.NET


Dim strConn As String = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + Server.MapPath('nwind.mdb') & ';'
Dim strsql As String = 'Select * from  Customers'
Dim cn As New OleDbConnection(strConn)
Dim ds As DataSet = New DataSet()
Dim da As New OleDbDataAdapter(strsql, cn)
da.Fill(ds, 'T1')
DataGrid1.DataSource = ds
DataGrid1.DataBind()

C#


string  strConn  = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + Server.MapPath('nwind.mdb') + ';';
string strsql  = 'Select * from  Customers';
OleDbConnection cn = new OleDbConnection(strConn);
DataSet ds   = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(strsql, cn);
da.Fill(ds, 'T1');
DataGrid1.DataSource = ds;
DataGrid1.DataBind();

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.