Results 1 to 2 of 2

Thread: Well

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

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

  2. #2
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774

    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
  •  



Click Here to Expand Forum to Full Width