Ok I got ASP.NET and the NET Framework installed. Cna someone please point me in the right direction of connecting to and displaying data form an Access database.
This will be running locally, for now...
Any guidnce would be appreciated...
Printable View
Ok I got ASP.NET and the NET Framework installed. Cna someone please point me in the right direction of connecting to and displaying data form an Access database.
This will be running locally, for now...
Any guidnce would be appreciated...
Simple sample that pulls data from the NorthWind database(comes with Access I believe) and displays in a DataGrid.Quote:
Originally posted by James Stanich
Ok I got ASP.NET and the NET Framework installed. Cna someone please point me in the right direction of connecting to and displaying data form an Access database.
This will be running locally, for now...
Any guidnce would be appreciated...
Code:<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
void Page_Load(object sender, EventArgs e) {
string ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=D:\\DataBase\\northwind.mdb;";
string CommandText = "SELECT [Employees].[EmployeeID], [Employees].[LastName], [Employees].[FirstName],[Employees].[Title] FROM [Employees]";
OleDbConnection myConnection = new OleDbConnection(ConnectionString);
OleDbCommand myCommand = new OleDbCommand(CommandText, myConnection);
myConnection.Open();
DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
DataGrid1.DataBind();
}
</script>
<html>
<body style="font-family:arial">
<h2>
Simple Data Report
</h2>
<hr size="1">
<form runat="server">
<asp:datagrid id="DataGrid1" EnableViewState="False" runat="server" ForeColor="Black" BackColor="White" CellPadding="3" GridLines="None" CellSpacing="1">
<HeaderStyle Font-Bold="True" ForeColor="white" BackColor="#4A3C8C"></HeaderStyle>
<ItemStyle BackColor="#DEDFDE"></ItemStyle>
</asp:datagrid>
</form>
</body>
</html>
You should use more informative subject lines in any further posts. I was almost going to ignore this due to the "Well" you used.
John