Microsoft Access with ASP.net

  • Thread starter Thread starter Me
  • Start date Start date
M

Me

Is it possible to use ASP.net with Microsoft Access. From
what I can find ASP.net only works with SQL server.
That's kind of step backward from being able to access
any data source.
 
Yes, you can use Access with ASP.net.

Instead of the Sql objects, you can use the Oledb objects.
 
I'm new at ASP.net. I was playing with a dat grid but
could not figure out how to point it to an Access
database. I probably need to read more.

Thanks
 
I used this simple aspx page to get a used to interaction
with a Access database.

Hope it helps,

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script Language="c#" runat="server">
void Page_Load()
{
//ESTABLISH AND OPEN CONNECTION WITH Selection.mdb
string strConnection
= "Provider=Microsoft.Jet.OleDb.4.0;";

strConnection += @"Data Source=C:DB\Northwind.mdb";
OleDbConnection objConnection;
objConnection = new OleDbConnection(strConnection);


try
{
objConnection.Open();
con_open.Text="Connection opened
successfully.<br />";
objConnection.Close();
con_close.Text="Connection closed.<br />";
}
catch (Exception e)
{
con_open.Text="Connection failed to open.<br />";
con_close.Text=e.ToString();
}
}
</script>
<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
 
Back
Top