|
-
Jul 10th, 2002, 02:57 PM
#1
Thread Starter
PowerPoster
Well
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...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Jul 14th, 2002, 03:29 PM
#2
Fanatic Member
Re: Well
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...
Simple sample that pulls data from the NorthWind database(comes with Access I believe) and displays in a DataGrid.
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|