Controls You Can Use on Web Forms ASP.NET Data Source Controls AccessDataSource Control
Basically, retrieving data from a Microsoft Access database using the AccessDataSource control can be done in two ways:
- by specifying the SQL query to execute directly against the data file, or
- by referencing a query stored in the data file itself.
In the first case, you specify the SQL query by setting the AccessDataSource control’s SelectCommand property as shown in the following example.
<asp:accessdatasource id="ProductType" runat="server"
datafile="~/app_data/gear.mdb"
selectcommand="SELECT DISTINCT Type FROM Products"
datasourcemode="DataReader" />
Show me
In the second case, you specify the name of the Microsoft Access query to execute as the value of the SelectCommand, and set the SelectCommandType property value to StoredProcedure, as shown in the following example.
<asp:accessdatasource id="zipcodes" runat="server"
datafile="~/app_data/usa.mdb"
selectcommand="[Zipcodes By State and County]"
selectcommandtype="StoredProcedure">
<selectparameters>
<asp:controlparameter controlid="lstStates"
propertyname="SelectedValue" />
<asp:controlparameter controlid="lstCounties"
propertyname="SelectedValue" />
</selectparameters>
</asp:accessdatasource>
Show me