If you mean can you access and manipulate data in a Jet database (MDB) via
ADO.NET, yes, you can, using the components in the System.Data.OleDb
namespace (OleDbConnection, OleDbDataAdapter, OleDbCommand). I did encounter
some 'issues', which I described in an earlier post in this newsgroup, but I
managed to work around them.
Here's an example that fills a DataGrid control with data from the Employees
table in the Northwind database. Note that most of this code was generated
by VS.NET - the only code I had to write was the code in the Page_Load
event.
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.OleDbConnection1 = New System.Data.OleDb.OleDbConnection
Me.OleDbDataAdapter1 = New System.Data.OleDb.OleDbDataAdapter
Me.OleDbSelectCommand1 = New System.Data.OleDb.OleDbCommand
Me.DataSet11 = New WebApplication1.DataSet1
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).BeginInit()
'
'OleDbConnection1
'
Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial
Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB
atabase L" & _
"ocking Mode=1;Jet OLEDB
atabase Password=;Data Source=""C:\Program
Files\Microso" & _
"ft Office\Office\Samples\Northwind.mdb"";Password=;Jet OLEDB:Engine
Type=5;Jet OL" & _
"EDB:Global Bulk
Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:Syst" & _
"em database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share
Deny None;Jet O" & _
"LEDB:New Database Password=;Jet OLEDB:Create System
Database=False;Jet OLEDB
on" & _
"'t Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica
Repair=False;U" & _
"ser ID=Admin;Jet OLEDB:Encrypt Database=False"
'
'OleDbDataAdapter1
'
Me.OleDbDataAdapter1.SelectCommand = Me.OleDbSelectCommand1
Me.OleDbDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "Employees", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("EmployeeID", "EmployeeID"), New
System.Data.Common.DataColumnMapping("FirstName", "FirstName"), New
System.Data.Common.DataColumnMapping("LastName", "LastName")})})
'
'OleDbSelectCommand1
'
Me.OleDbSelectCommand1.CommandText = "SELECT EmployeeID, FirstName,
LastName FROM Employees"
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection1
'
'DataSet11
'
Me.DataSet11.DataSetName = "DataSet1"
Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-IE")
CType(Me.DataSet11,
System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents OleDbConnection1 As
System.Data.OleDb.OleDbConnection
Protected WithEvents OleDbDataAdapter1 As
System.Data.OleDb.OleDbDataAdapter
Protected WithEvents OleDbSelectCommand1 As
System.Data.OleDb.OleDbCommand
Protected WithEvents DataSet11 As WebApplication1.DataSet1
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
OleDbDataAdapter1.Fill(DataSet11)
DataGrid1.DataBind()
End If
End Sub
End Class