Microsoft Access with ASP.net

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.
 
D

dot365

Yes, you can use Access with ASP.net.

Instead of the Sql objects, you can use the Oledb objects.
 
M

Me

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
 
L

Leif

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top