Source view of ACCESSDATASOURCE.ASPX
DotNet Funda: Code Viewer
accessdatasource.aspx | accessdatasource.aspx.cs
Close Window  
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server">
    <table width="100%" cellpadding="0" cellspacing="0">
        <tr valign="top" class="ArticleTitle">
            <td><h1>asp:AccessDataSource control</h1></td>
        </tr>
        <tr>
            <td class="ArticleContents">
                AccessDataSource control is a data source control that is used to connect to Ms Access database.
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;</td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderForContents" Runat="Server">
    <div class="ArticleContents">
        AccessDataSource control is a data source control that is used to connect to Ms Access database. 
        Instead of <span class="DemoCP">ConnectionString</span> property, it has <span class="DemoCP">DataFile</span> property that is used to specify Ms-Access database path.
        
        <br /><br />        
        <table width="100%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
            <tr>
                <th colspan="2" align="left">
                    As AccessDataSource control is based on SqlDataSource control, so its properties are almost same as SqlDataSource. 
                    <br />
                    Go to <a href="sqldatasource.aspx#prop">SqlDataSource Control</a>.
                </th>
            </tr>
        </table>
        <!-- START - Demo Section -->
        <table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
            <tr>
                <td class="DemoTitle">
                    DEMO : AccessDataSource Control - <u>Sorry sample is not available for AccessDataSource Control</u>
                </td>
                <td align="right">
                    <a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/controls/accessdatasource.aspx" target="_blank">Show Source Code</a>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:DetailsView ID="DetailsView1" runat="Server" CellPadding="4" ForeColor="#333333" GridLines="None"
                     Width="100%" AllowPaging="True" AutoGenerateRows="True" DataKeyNames="pid">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                        <EditRowStyle BackColor="#999999" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    </asp:DetailsView>
                    
                    <asp:AccessDataSource ID="AccessDataSource1" runat="Server" DataFile="~/AnyDb.mdb"
                     SelectCommand="SELECT * FROM payments ORDER BY pdate DESC"></asp:AccessDataSource>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <!-- START - Server Side Code -->
                    <pre>
                    
    // DetailsView Control //////////////////////    
    &lt;asp:DetailsView ID="DetailsView1" runat="Server" CellPadding="4" ForeColor="#333333" GridLines="None"
         Width="100%" DataSourceID="AccessDataSource1" AllowPaging="True" AutoGenerateRows="True" DataKeyNames="pid"&gt;
            &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
            &lt;CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /&gt;
            &lt;EditRowStyle BackColor="#999999" /&gt;
            &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
            &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
            &lt;FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" /&gt;
            &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
            &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
        &lt;/asp:DetailsView&gt;
    
    
    // AccessDataSource Control //////////////////////
        &lt;asp:AccessDataSource ID="AccessDataSource1" runat="Server" DataFile="~/AnyDb.mdb"
         SelectCommand="SELECT * FROM payments ORDER BY pdate DESC"&gt;&lt;/asp:AccessDataSource&gt;
                                    
    </pre> 
                    <!-- END - Server Side Code -->
                </td>
            </tr>
        </table>
        <!-- END - Demo Section -->
        </div>
    <br />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>

Go Top