System.Web 2.0.0.0 System.Web.UI.WebControls.SqlDataSource System.Drawing.ToolboxBitmap("") System.ComponentModel.Designer("System.Web.UI.Design.WebControls.AccessDataSourceDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner") The class is a data source control that works with Microsoft Access databases. Like its base class, , the control uses SQL queries to perform data retrieval. One of the unique characteristics of the control is that you do not set the property. All you need to do is set the location of the Access (.mdb) file in the property and the takes care of the underlying connection to the database. You should place Access databases in the App_Data directory of the Web site and reference them by a relative path (for example, ~/App_Data/Northwind.mdb). This location offers additional security for data files, because they are not served if they are requested directly by the client Web browser. The class does not support connecting to Access databases that are protected by a user name or password, because you cannot set the property. If your Access database is protected by a user name or password, use the control to connect to it so that you can specify a complete connection string. You bind data-bound controls to an using the DataSourceID property of the data-bound control. For more information about binding a data-bound control to data source controls, see Binding to Data Using a Data Source Control. Because the control is specific to only one database product, it always uses the same provider—the .NET data provider. For this reason, the property is read-only. When using the provider, the order of the parameters in a parameterized SQL statement is significant; any parameterized SQL queries that you specify in the , , , and properties must match the order of any objects that are in the corresponding parameter collection. If no parameter collection is specified on the , the order of parameters that are supplied to these operations must match the order in which they appear in the underlying SQL statement. For more information, see Using the SqlDataSource and AccessDataSource Controls with Parameters. The control supports the same caching behavior that its base class supports. Use caching to increase the performance of pages that use the control. For more information about data source caching, see Caching Data using Data Source Controls. The following table describes the features of the control. Capability Requirements Sorting Set the property to the value. Filtering Set the property to a filtering expression used to filter the data when the method is called. Paging The does not support direct paging operations on an Access database. A data-bound control, such as the , can page over the items returned by the , if the property is set to the value.  Updating Set the property to a SQL statement used to update data. This statement is typically parameterized. Deleting Set the property to a SQL statement used to delete data. This statement is typically parameterized. Inserting Set the property to a SQL statement used to insert data. This statement is typically parameterized. Caching Set the property to the value, the property to true, and the and properties according to the caching behavior you want for your cached data. As with all data source controls, the control is associated with a strongly typed data source view class. Just as the control extends the control, the class extends the class. The class overrides a few of the methods to use the .NET data provider. There is no visual rendering of the control; it is implemented as a control to enable declarative persistence and to permit, optionally, participation in state management. As a result, you cannot set properties that support visual features, such as the and properties.

Declarative Syntax

<asp:AccessDataSource     CacheDuration="string|Infinite"     CacheExpirationPolicy="Absolute|Sliding"     CacheKeyDependency="string"     CancelSelectOnNullParameter="True|False"     ConflictDetection="OverwriteChanges|CompareAllValues"     DataFile="uri"     DataSourceMode="DataReader|DataSet"     DeleteCommand="string"     DeleteCommandType="Text|StoredProcedure"     EnableCaching="True|False"     EnableTheming="True|False"     EnableViewState="True|False"     FilterExpression="string"     ID="string"     InsertCommand="string"     InsertCommandType="Text|StoredProcedure"     OldValuesParameterFormatString="string"     OnDataBinding="DataBinding event handler"     OnDeleted="Deleted event handler"     OnDeleting="Deleting event handler"     OnDisposed="Disposed event handler"     OnFiltering="Filtering event handler"     OnInit="Init event handler"     OnInserted="Inserted event handler"     OnInserting="Inserting event handler"     OnLoad="Load event handler"     OnPreRender="PreRender event handler"     OnSelected="Selected event handler"     OnSelecting="Selecting event handler"     OnUnload="Unload event handler"     OnUpdated="Updated event handler"     OnUpdating="Updating event handler"     runat="server"     SelectCommand="string"     SelectCommandType="Text|StoredProcedure"     SkinID="string"     SortParameterName="string"     UpdateCommand="string"     UpdateCommandType="Text|StoredProcedure"     Visible="True|False" >         <DeleteParameters>                 <asp:ControlParameter                     ControlID="string"                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput| ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:CookieParameter                     ConvertEmptyStringToNull="True|False"                     CookieName="string"                     DefaultValue="string"                     Direction="Input|Output|InputOutput| ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:FormParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     FormField="string"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:Parameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64 |Single|Double|Decimal|DateTime|String"                 />                 <asp:ProfileParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:QueryStringParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     QueryStringField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:SessionParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     SessionField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />         </DeleteParameters>         <FilterParameters>                 <asp:ControlParameter                     ControlID="string"                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:CookieParameter                     ConvertEmptyStringToNull="True|False"                     CookieName="string"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:FormParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     FormField="string"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:Parameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:ProfileParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:QueryStringParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     QueryStringField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:SessionParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     SessionField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />         </FilterParameters>         <InsertParameters>                 <asp:ControlParameter                     ControlID="string"                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:CookieParameter                     ConvertEmptyStringToNull="True|False"                     CookieName="string"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:FormParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     FormField="string"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:Parameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:ProfileParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:QueryStringParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     QueryStringField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:SessionParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     SessionField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />         </InsertParameters>         <SelectParameters>                 <asp:ControlParameter                     ControlID="string"                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:CookieParameter                     ConvertEmptyStringToNull="True|False"                     CookieName="string"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:FormParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     FormField="string"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:Parameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:ProfileParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:QueryStringParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     QueryStringField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:SessionParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     SessionField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />         </SelectParameters>         <UpdateParameters>                 <asp:ControlParameter                     ControlID="string"                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:CookieParameter                     ConvertEmptyStringToNull="True|False"                     CookieName="string"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:FormParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     FormField="string"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:Parameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:ProfileParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     PropertyName="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:QueryStringParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     QueryStringField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />                 <asp:SessionParameter                     ConvertEmptyStringToNull="True|False"                     DefaultValue="string"                     Direction="Input|Output|InputOutput|ReturnValue"                     Name="string"                     SessionField="string"                     Size="integer"                     Type="Empty|Object|DBNull|Boolean|Char|SByte| Byte|Int16|UInt16|Int32|UInt32|Int64|UInt64| Single|Double|Decimal|DateTime|String"                 />         </UpdateParameters> </asp:AccessDataSource>
Represents a Microsoft Access database for use with data-bound controls.
Constructor To be added. Initializes a new instance of the class. 2.0.0.0 Constructor To be added. Initializes a new instance of the class with the specified data file path and Select command. The location of the Access .mdb file. The location can be relative to the current Web form's folder, an absolute physical path, or a virtual path. The SQL query used to retrieve data from the Access database. If the SQL query is a parameterized SQL string, add objects to the collection. 2.0.0.0 Property System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.Browsable(false) System.String To be added. The control can be used only with the .NET data provider, and the connection string that uses is specific to this provider. Therefore, the control exposes connection string settings, such as the property, as a property and constructs a connection string at run time using the values of the property, if set. Gets the connection string that is used to connect to the Microsoft Access database. 2.0.0.0 Method System.Web.UI.WebControls.SqlDataSourceView Classes that derive from the class can override the method to return strongly typed data source view objects. Creates a data source view object that is associated with the data source control. An object that is associated with the instance. The name of the data source view. 2.0.0.0 Property System.ComponentModel.Editor("System.Web.UI.Design.MdbDataFileEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") System.ComponentModel.DefaultValue("") System.Web.UI.UrlProperty System.String To be added. The property is a virtual, absolute, or UNC directory path to the Access .mdb file that the control represents. If only the name of the file is entered, this indicates that the .mdb file is found in the same directory as the currently executing Web Forms page or code. Relative paths with both forward and backward slashes are supported. For example, "./test/test/Northwind.mdb" maps to the same path as ".\test\test\Northwind.mdb" and "test/test/Northwind.mdb". UNC paths, such as "\\mymachine\somedatadirectory\Northwind.mdb", are also supported. Although absolute physical paths are supported, you should avoid using them because they can complicate deployment.

Configuring Permissions for an Access Database

An important aspect of working with an Access .mdb file is to configure permissions properly. When a Web application uses an Access database, the application must have Read permission to the .mdb file so that it can access the data. In addition, the application must have Write permission to the folder containing the .mdb file. Write permission is required because Access creates an additional file with the extension .ldb in which it maintains information about database locks for concurrent users. The .ldb file is created at run time. By default, ASP.NET Web applications run in the context of a local machine account called ASPNET (for Microsoft Windows 2000 and Microsoft Windows XP), or in the context of the NETWORK SERVICE account (for Microsoft Windows Server 2003). For example, for Windows 2000 or Windows XP, if the Web server is named MyServer, ASP.NET applications on the MyServer computer run in the context of the local account MyServer\ASPNET. Therefore, to use an Access database in an ASP.NET Web application, you must configure the folder containing the Access database to have both Read and Write permissions. When you create a Web site in the Microsoft Visual Web Developer Web development tool, Visual Web Developer creates a folder named App_Data below the current root folder. The folder is designed to be a store for application data, including Access databases. The App_Data folder is also used by ASP.NET to store databases that the system maintains, such as the database for membership and roles. When Visual Web Developer creates the App_Data folder, it grants Read and Write permissions for the folder to the ASPNET or NETWORK SERVICE user account. As a security measure, Visual Web Developer also configures the App_Data folder so that files in the folder are not served by the Web server. Do not store any Web pages in the App_Data folder, because users will see an error if they request a page from that folder.
Gets or sets the location of the Microsoft Access .mdb file.
2.0.0.0
Method System.Data.Common.DbProviderFactory To be added. Retrieves a object that is associated with the .NET data provider that is identified by the property. An object. 2.0.0.0 Property System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.Browsable(false) System.String To be added. While the control exposes the property because it is inherited from its base class, attempting to set the property results in a exception. Gets the name of the .NET data provider that the control uses to connect to a Microsoft Access database. 2.0.0.0 Property System.ComponentModel.Browsable(false) System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.String To be added. In the base class, , the property gets or sets a semicolon-delimited string that indicates which databases and tables to use for the Microsoft SQL Server cache dependency. Cache dependency is not supported by Microsoft Access, and any access to the property results in a exception. The property overrides the property. 2.0.0.0