AccessDataSource 類別

定義

表示搭配資料繫結控制項使用的 Microsoft Access 資料庫。

public ref class AccessDataSource : System::Web::UI::WebControls::SqlDataSource
[System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.AccessDataSource))]
public class AccessDataSource : System.Web.UI.WebControls.SqlDataSource
[<System.Drawing.ToolboxBitmap(typeof(System.Web.UI.WebControls.AccessDataSource))>]
type AccessDataSource = class
    inherit SqlDataSource
Public Class AccessDataSource
Inherits SqlDataSource
繼承
屬性

範例

下列程式碼範例示範使用 控制項的常見顯示和更新案例 GridView 。 屬性 SelectCommand 會設定為適當的 SQL 查詢,而 Northwind 資料庫中的資料會顯示在 控制項中 GridViewUpdateCommand因為也會指定屬性, AutoGenerateEditButton 而且 屬性設定為 true ,所以您可以編輯和更新記錄,而不需要額外的程式碼。 控制項 GridView 會處理將參數新增至 UpdateParameters 集合; GridView 控制項會先傳遞 物件的參數值 BoundField ,後面接著 屬性所 DataKeyNames 指定的欄位值。 會自動 GridView 呼叫 Update 方法。 如果您想要明確排序參數,請在 上 AccessDataSource 指定 UpdateParameters 集合。

<%@Page  Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">

      <asp:accessdatasource
        id="AccessDataSource1"
        runat="server"
        datasourcemode="DataSet"
        datafile="~/App_Data/Northwind.mdb"
        selectcommand="SELECT EmployeeID,FirstName,LastName,Title FROM Employees"
        updatecommand="Update Employees SET FirstName=?,LastName=?,Title=? WHERE EmployeeID=@EmployeeID">
      </asp:accessdatasource>

      <asp:gridview
        id="GridView1"
        runat="server"
        autogeneratecolumns="False"
        datakeynames="EmployeeID"
        autogenerateeditbutton="True"
        datasourceid="AccessDataSource1">
        <columns>
          <asp:boundfield headertext="First Name" datafield="FirstName" />
          <asp:boundfield headertext="Last Name" datafield="LastName" />
          <asp:boundfield headertext="Title" datafield="Title" />
        </columns>
      </asp:gridview>

    </form>
  </body>
</html>
<%@Page  Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">

      <asp:accessdatasource
        id="AccessDataSource1"
        runat="server"
        datasourcemode="DataSet"
        datafile="~/App_Data/Northwind.mdb"
        selectcommand="SELECT EmployeeID,FirstName,LastName,Title FROM Employees"
        updatecommand="Update Employees SET FirstName=?,LastName=?,Title=? WHERE EmployeeID=@EmployeeID">
      </asp:accessdatasource>

      <asp:gridview
        id="GridView1"
        runat="server"
        autogeneratecolumns="False"
        datakeynames="EmployeeID"
        autogenerateeditbutton="True"
        datasourceid="AccessDataSource1">
        <columns>
          <asp:boundfield headertext="First Name" datafield="FirstName" />
          <asp:boundfield headertext="Last Name" datafield="LastName" />
          <asp:boundfield headertext="Title" datafield="Title" />
        </columns>
      </asp:gridview>

    </form>
  </body>
</html>

備註

類別 AccessDataSource 是可與 Microsoft Access 資料庫搭配運作的資料來源控制項。 如同其基類, SqlDataSource 控制項會 AccessDataSource 使用 SQL 查詢來執行資料擷取。

控制項的唯一特性 AccessDataSource 之一是您未設定 ConnectionString 屬性。 您只需要在 屬性中 DataFile 設定 Access (.mdb) 檔案的位置,並 AccessDataSource 處理資料庫的基礎連線。 您應該將 Access 資料庫放在網站的App_Data目錄中,並以相對路徑 (加以參考,例如) ~/App_Data/Northwind.mdb 。 此位置會為資料檔案提供額外的安全性,因為如果用戶端網頁瀏覽器直接要求,則不會提供它們。

類別 AccessDataSource 不支援連線到受使用者名稱或密碼保護的 Access 資料庫,因為您無法設定 ConnectionString 屬性。 如果您的 Access 資料庫受到使用者名稱或密碼的保護,請使用 SqlDataSource 控制項來連線到該資料庫,以便指定完整的連接字串。

您可以使用資料繫結控制項的 屬性,將資料繫結控制項系結至 AccessDataSourceDataSourceID 。 如需將資料繫結控制項系結至資料來源控制項的詳細資訊,請參閱 使用資料來源控制項系結至資料

AccessDataSource因為控制項只專屬於一個資料庫產品,所以一律使用相同的提供者 - System.Data.OleDb .NET 資料提供者。 基於這個理由, ProviderName 屬性是唯讀的。 使用 System.Data.OleDb 提供者時,參數化 SQL 語句中的參數順序很重要;您在 、 UpdateCommandInsertCommandDeleteCommand 屬性中指定的 SelectCommand 任何參數化 SQL 查詢都必須符合對應參數集合中任何 Parameter 物件的順序。 如果未在 上 AccessDataSource 指定任何參數集合,提供給這些作業的參數順序必須符合它們出現在基礎 SQL 語句中的順序。 如需詳細資訊,請參閱 搭配 SqlDataSource 控制項使用參數

控制項 AccessDataSource 支援其基類支援的相同快取行為。 使用快取來增加使用 AccessDataSource 控制項的頁面效能。 如需資料來源快取的詳細資訊,請參閱 使用資料來源控制項快取資料

下表描述 控制項的功能 AccessDataSource

功能 需求
排序 DataSourceMode 屬性設定為 DataSet 值。
篩選 FilterExpression 屬性設定為篩選運算式,以在呼叫 方法時 Select 用來篩選資料。
Paging AccessDataSource不支援 Access 資料庫的直接分頁作業。 如果 DataSourceMode 屬性設定 DataSet 為 值,資料繫結控制項例如 GridView , 可以逐頁流覽 所 AccessDataSource 傳回的專案。
更新 UpdateCommand 屬性設定為用來更新資料的 SQL 語句。 此語句通常會參數化。
刪除 DeleteCommand 屬性設定為用來刪除資料的 SQL 語句。 此語句通常會參數化。
插入 InsertCommand 屬性設定為用來插入資料的 SQL 語句。 此語句通常會參數化。
Caching DataSourceMode 屬性設定為 DataSet 值、 EnableCaching 將 屬性設定為 true ,並根據 CacheDuration 快取資料所需的快取行為,將 和 CacheExpirationPolicy 屬性設定為 。

如同所有資料來源控制項,控制項 AccessDataSource 會與強型別資料來源檢視類別相關聯。 就像控制項擴充 SqlDataSource 控制項一樣 AccessDataSource ,類別會 AccessDataSourceViewSqlDataSourceView 擴充 類別。 類別 AccessDataSourceView 會覆寫一 SqlDataSourceView 些方法,以使用 System.Data.OleDb .NET 資料提供者。

控制項沒有視覺化轉 AccessDataSource 譯;它會實作為控制項,以啟用宣告式持續性,並選擇性地允許參與狀態管理。 因此,您無法設定支援視覺功能的屬性,例如 EnableThemingSkinID 屬性。

宣告式語法

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

建構函式

AccessDataSource()

初始化 AccessDataSource 類別的新執行個體。

AccessDataSource(String, String)

使用指定的資料檔案路徑和 Select 命令,初始化 AccessDataSource 類別的新執行個體。

屬性

Adapter

針對控制項取得瀏覽器的特定配置器。

(繼承來源 Control)
AppRelativeTemplateSourceDirectory

取得或設定包含了此控制項之 PageUserControl 物件的相對應用程式虛擬目錄。

(繼承來源 Control)
BindingContainer

取得包含了此控制項之資料繫結的控制項。

(繼承來源 Control)
CacheDuration

取得或設定資料來源控制項快取 Select(DataSourceSelectArguments) 方法所擷取之資料的時間長度 (以秒為單位)。

(繼承來源 SqlDataSource)
CacheExpirationPolicy

取得或設定快取到期行為,當與持續期間搭配使用時,用來描述資料來源控制項所使用的快取行為。

(繼承來源 SqlDataSource)
CacheKeyDependency

取得或設定使用者定義的索引鍵相依性,連結至資料來源控制項所建立的所有資料快取物件。 當索引鍵過期時,所有快取的物件也會明確過期。

(繼承來源 SqlDataSource)
CancelSelectOnNullParameter

取得或設定值,指出當 SelectParameters 集合中包含的任何參數評估為 null 時,是否取消資料擷取作業。

(繼承來源 SqlDataSource)
ChildControlsCreated

取得值,指出是否已經建立伺服器控制項的子控制項。

(繼承來源 Control)
ClientID

取得 ASP.NET 產生的伺服器控制項識別項。

(繼承來源 DataSourceControl)
ClientIDMode

這個屬性不會用於資料來源控制項。

(繼承來源 DataSourceControl)
ClientIDSeparator

取得字元值,表示在 ClientID 屬性中所使用的分隔字元。

(繼承來源 Control)
ConflictDetection

取得或設定值,指出在作業期間,當基礎資料庫的資料列資料發生變更時,SqlDataSource 控制項如何執行更新和刪除作業。

(繼承來源 SqlDataSource)
ConnectionString

取得連接字串,用於連接 Microsoft Access 資料庫。

Context

取得與目前 Web 要求的伺服器控制項關聯的 HttpContext 物件。

(繼承來源 Control)
Controls

取得 ControlCollection 物件,表示 UI 階層架構中指定之伺服器控制項的子控制項。

(繼承來源 DataSourceControl)
DataFile

取得或設定 Microsoft Access .mdb 檔的位置。

DataItemContainer

如果命名容器實作 IDataItemContainer,則取得命名容器的參考。

(繼承來源 Control)
DataKeysContainer

如果命名容器實作 IDataKeysControl,則取得命名容器的參考。

(繼承來源 Control)
DataSourceMode

取得或設定 SqlDataSource 控制項用於擷取資料的資料擷取模式。

(繼承來源 SqlDataSource)
DeleteCommand

取得或設定 SQL 字串,SqlDataSource 控制項會用來刪除基礎資料庫的資料。

(繼承來源 SqlDataSource)
DeleteCommandType

取得或設定值,指出 DeleteCommand 屬性中的文字是 SQL 陳述式還是預存程序的名稱。

(繼承來源 SqlDataSource)
DeleteParameters

取得參數集合,包含與 DeleteCommand 控制項相關聯之 SqlDataSourceView 物件 SqlDataSource 屬性所使用的參數。

(繼承來源 SqlDataSource)
DesignMode

取得值,指出控制項是否正用於設計介面上。

(繼承來源 Control)
EnableCaching

取得或設定值,指出 SqlDataSource 控制項是否啟用了資料快取。

(繼承來源 SqlDataSource)
EnableTheming

取得值,指出這個控制項是否支援佈景主題。

(繼承來源 DataSourceControl)
EnableViewState

取得或設定值,該值表示伺服器控制項是否對要求的用戶端而言保持其檢視狀態,以及它包含的任何子控制項狀態。

(繼承來源 Control)
Events

取得控制項事件處理常式委派 (Delegate) 的清單。 這個屬性是唯讀的。

(繼承來源 Control)
FilterExpression

取得或設定當呼叫 Select(DataSourceSelectArguments) 時會套用的篩選運算式。

(繼承來源 SqlDataSource)
FilterParameters

取得與 FilterExpression 字串中任何參數替代符號相關聯的參數集合。

(繼承來源 SqlDataSource)
HasChildViewState

取得值,指出目前伺服器控制項的子控制項是否有任何已儲存的檢視狀態設定。

(繼承來源 Control)
ID

取得或設定指派給伺服器控制項的程式設計識別項。

(繼承來源 Control)
IdSeparator

取得用來分隔控制項識別項的字元。

(繼承來源 Control)
InsertCommand

取得或設定 SQL 字串,SqlDataSource 控制項會用來將資料插入基礎資料庫。

(繼承來源 SqlDataSource)
InsertCommandType

取得或設定值,指出 InsertCommand 屬性中的文字是 SQL 陳述式還是預存程序的名稱。

(繼承來源 SqlDataSource)
InsertParameters

取得參數集合,包含與 InsertCommand 控制項相關聯之 SqlDataSourceView 物件 SqlDataSource 屬性所使用的參數。

(繼承來源 SqlDataSource)
IsChildControlStateCleared

取得值,指出這個控制項中所包含的控制項是否有控制項狀態。

(繼承來源 Control)
IsTrackingViewState

取得值,指出伺服器控制項是否正在儲存檢視狀態的變更。

(繼承來源 Control)
IsViewStateEnabled

取得值,指出這個控制項是否已啟用檢視狀態。

(繼承來源 Control)
LoadViewStateByID

取得值,指出控制項是否依 ID (而不是索引) 參與載入其檢視狀態。

(繼承來源 Control)
NamingContainer

取得伺服器控制項命名容器的參考,其建立唯一命名空間,在具有相同 ID 屬性值的伺服器控制項之間作區別。

(繼承來源 Control)
OldValuesParameterFormatString

取得或設定格式字串,套用至傳遞給 Delete()Update() 方法之任何參數的名稱。

(繼承來源 SqlDataSource)
Page

取得含有伺服器控制項的 Page 執行個體的參考。

(繼承來源 Control)
Parent

在網頁控制階層架構中取得伺服器控制項之父控制項的參考。

(繼承來源 Control)
ProviderName

取得 .NET 資料提供者的名稱,AccessDataSource 控制項會用來連接至 Microsoft Access 資料庫。

RenderingCompatibility

取得值,這個值會指定將與呈現 HTML 相容的 ASP.NET 版本。

(繼承來源 Control)
SelectCommand

取得或設定 SQL 字串,SqlDataSource 控制項會用來擷取基礎資料庫的資料。

(繼承來源 SqlDataSource)
SelectCommandType

取得或設定值,指出 SelectCommand 屬性中的文字是 SQL 查詢還是預存程序的名稱。

(繼承來源 SqlDataSource)
SelectParameters

取得參數集合,包含與 SelectCommand 控制項相關聯之 SqlDataSourceView 物件 SqlDataSource 屬性所使用的參數。

(繼承來源 SqlDataSource)
Site

當呈現在設計介面上時,取得裝載目前控制項之容器的資訊。

(繼承來源 Control)
SkinID

取得套用至 DataSourceControl 控制項的面板。

(繼承來源 DataSourceControl)
SortParameterName

取得或設定預存程序參數的名稱,用於在使用預存程序執行資料擷取時,對擷取的資料進行排序。

(繼承來源 SqlDataSource)
SqlCacheDependency

SqlCacheDependency 屬性會覆寫 SqlCacheDependency 屬性。

TemplateControl

取得或設定包含了此控制項之樣板的參考。

(繼承來源 Control)
TemplateSourceDirectory

取得包含目前伺服器控制項的 PageUserControl 的虛擬目錄。

(繼承來源 Control)
UniqueID

取得伺服器控制項唯一的、符合階層架構的識別項。

(繼承來源 Control)
UpdateCommand

取得或設定 SQL 字串,SqlDataSource 控制項會用來更新基礎資料庫的資料。

(繼承來源 SqlDataSource)
UpdateCommandType

取得或設定值,指出 UpdateCommand 屬性中的文字是 SQL 陳述式還是預存程序的名稱。

(繼承來源 SqlDataSource)
UpdateParameters

取得參數集合,包含與 UpdateCommand 控制項相關聯之 SqlDataSourceView 控制項 SqlDataSource 屬性所使用的參數。

(繼承來源 SqlDataSource)
ValidateRequestMode

取得或設定值,指出控制項是否對來自瀏覽器的用戶端輸入檢查潛在的危險值。

(繼承來源 Control)
ViewState

取得狀態資訊的字典,允許您在相同網頁的多個要求之間,儲存和還原伺服器控制項的檢視狀態。

(繼承來源 Control)
ViewStateIgnoresCase

取得值,指出 StateBag 物件是否不區分大小寫。

(繼承來源 Control)
ViewStateMode

取得或設定這個控制項的檢視狀態模式。

(繼承來源 Control)
Visible

取得或設定值,指出是否視覺化顯示控制項。

(繼承來源 DataSourceControl)

方法

AddedControl(Control, Int32)

在子控制項加入 Control 物件的 Controls 集合後呼叫。

(繼承來源 Control)
AddParsedSubObject(Object)

通知伺服器控制項,XML 或 HTML 項目已剖析,並將項目加入伺服器控制項的 ControlCollection 物件中。

(繼承來源 Control)
ApplyStyleSheetSkin(Page)

將頁面樣式表中所定義的樣式屬性套用至控制項。

(繼承來源 DataSourceControl)
BeginRenderTracing(TextWriter, Object)

開始進行轉譯資料的設計階段追蹤。

(繼承來源 Control)
BuildProfileTree(String, Boolean)

收集伺服器控制項的相關資訊,並在頁面啟用追蹤時將此資訊傳遞至 Trace 屬性以顯示之。

(繼承來源 Control)
ClearCachedClientID()

將快取的 ClientID 值設定為 null

(繼承來源 Control)
ClearChildControlState()

刪除伺服器控制項之子控制項的控制項狀態資訊。

(繼承來源 Control)
ClearChildState()

刪除所有伺服器控制項之子控制項的檢視狀態和控制項狀態資訊。

(繼承來源 Control)
ClearChildViewState()

刪除所有伺服器控制項之子控制項的檢視狀態資訊。

(繼承來源 Control)
ClearEffectiveClientIDMode()

將目前的控制項執行個體和任何子控制項的 ClientIDMode 屬性設定為 Inherit

(繼承來源 Control)
CreateChildControls()

由 ASP.NET 網頁架構呼叫,通知使用組合實作的伺服器控制項來建立所包含的任何子控制項,以準備回傳或呈現。

(繼承來源 Control)
CreateControlCollection()

建立儲存子控制項的集合。

(繼承來源 DataSourceControl)
CreateDataSourceView(String)

建立與資料來源控制項相關聯的資料來源檢視物件。

DataBind()

將資料來源繫結至所叫用的伺服器控制項及其所有子控制項。

(繼承來源 Control)
DataBind(Boolean)

使用會引發 DataBinding 事件的選項,繫結資料來源至叫用的伺服器控制項及其所有子控制項。

(繼承來源 Control)
DataBindChildren()

繫結資料來源至伺服器控制項的子控制項。

(繼承來源 Control)
Delete()

使用 DeleteCommand SQL 字串和 DeleteParameters 集合中的任何參數,執行刪除作業。

(繼承來源 SqlDataSource)
Dispose()

啟用伺服器控制項,在它從記憶體釋放之前執行最後清除。

(繼承來源 Control)
EndRenderTracing(TextWriter, Object)

結束轉譯資料的設計階段追蹤。

(繼承來源 Control)
EnsureChildControls()

判斷伺服器控制項是否包含子控制項。 如果不包含,則建立子控制項。

(繼承來源 Control)
EnsureID()

為尚未指定識別項的控制項,建立識別項。

(繼承來源 Control)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
FindControl(String)

在目前命名容器搜尋具有指定 id 參數的伺服器控制項。

(繼承來源 DataSourceControl)
FindControl(String, Int32)

使用指定的 id 和有助於搜尋之 pathOffset 參數中所指定的整數,在目前的命名容器中搜尋伺服器控制項。 您不應該覆寫這個版本的 FindControl 方法。

(繼承來源 Control)
Focus()

設定控制項的輸入焦點。

(繼承來源 DataSourceControl)
GetDbProviderFactory()

擷取與 DbProviderFactory 屬性識別之 .NET 資料提供者關聯的 ProviderName 物件。

GetDesignModeState()

取得控制項的設計階段資料。

(繼承來源 Control)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetRouteUrl(Object)

取得會對應於一組路由參數的 URL。

(繼承來源 Control)
GetRouteUrl(RouteValueDictionary)

取得會對應於一組路由參數的 URL。

(繼承來源 Control)
GetRouteUrl(String, Object)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。

(繼承來源 Control)
GetRouteUrl(String, RouteValueDictionary)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。

(繼承來源 Control)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
GetUniqueIDRelativeTo(Control)

傳回指定之控制項 UniqueID 屬性的前置部分。

(繼承來源 Control)
GetView(String)

取得與資料來源控制項相關聯的具名資料來源檢視。

(繼承來源 SqlDataSource)
GetViewNames()

取得名稱集合,表示與 SqlDataSource 控制項相關聯的檢視物件清單。

(繼承來源 SqlDataSource)
HasControls()

判斷伺服器控制項是否包含任何子控制項。

(繼承來源 DataSourceControl)
HasEvents()

傳回值,指出控制項或任何子控制項的事件是否已註冊。

(繼承來源 Control)
Insert()

使用 InsertCommand SQL 字串和 InsertParameters 集合中的任何參數,執行插入作業。

(繼承來源 SqlDataSource)
IsLiteralContent()

判斷伺服器控制項是否只儲存常值內容。

(繼承來源 Control)
LoadControlState(Object)

SaveControlState() 方法所儲存的上一頁要求中,還原控制項狀態資訊。

(繼承來源 Control)
LoadViewState(Object)

載入 SqlDataSource 控制項中需要保存的屬性狀態。

(繼承來源 SqlDataSource)
MapPathSecure(String)

擷取虛擬絕對路徑或相對路徑所對應至的實體路徑。

(繼承來源 Control)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnBubbleEvent(Object, EventArgs)

決定伺服器控制項的事件是否要在頁面的 UI 伺服器控制項階層架構中向上傳遞。

(繼承來源 Control)
OnDataBinding(EventArgs)

引發 DataBinding 事件。

(繼承來源 Control)
OnInit(EventArgs)

LoadComplete 事件處理常式加入包含 Page 控制項的 SqlDataSource 控制項。

(繼承來源 SqlDataSource)
OnLoad(EventArgs)

引發 Load 事件。

(繼承來源 Control)
OnPreRender(EventArgs)

引發 PreRender 事件。

(繼承來源 Control)
OnUnload(EventArgs)

引發 Unload 事件。

(繼承來源 Control)
OpenFile(String)

取得用來讀取檔案的 Stream

(繼承來源 Control)
RaiseBubbleEvent(Object, EventArgs)

指派事件的任何來源和它的資訊至控制項的父控制項。

(繼承來源 Control)
RaiseDataSourceChangedEvent(EventArgs)

引發 DataSourceChanged 事件。

(繼承來源 DataSourceControl)
RemovedControl(Control)

Control 物件的 Controls 集合中移除子控制項之後呼叫。

(繼承來源 Control)
Render(HtmlTextWriter)

將伺服器控制項內容傳送到提供的 HtmlTextWriter 物件,以寫入要在用戶端上呈現的內容。

(繼承來源 Control)
RenderChildren(HtmlTextWriter)

將伺服器控制項子系的內容輸出至提供的 HtmlTextWriter 物件,再由這個物件在用戶端上寫入要轉譯的內容。

(繼承來源 Control)
RenderControl(HtmlTextWriter)

將伺服器控制項內容輸出至提供的 HtmlTextWriter 物件,並在啟用追蹤時儲存控制項的追蹤資訊。

(繼承來源 DataSourceControl)
RenderControl(HtmlTextWriter, ControlAdapter)

使用提供的 HtmlTextWriter 物件,輸出伺服器控制項內容至提供的 ControlAdapter 物件。

(繼承來源 Control)
ResolveAdapter()

取得負責呈現指定之控制項的控制項配置器。

(繼承來源 Control)
ResolveClientUrl(String)

取得瀏覽器可使用的 URL。

(繼承來源 Control)
ResolveUrl(String)

將 URL 轉換為要求用戶端可使用的 URL。

(繼承來源 Control)
SaveControlState()

儲存頁面回傳至伺服器以來,所發生的任何伺服器控制項狀態變更。

(繼承來源 Control)
SaveViewState()

儲存 SqlDataSource 控制項的目前檢視狀態。

(繼承來源 SqlDataSource)
Select(DataSourceSelectArguments)

使用 SelectCommand SQL 字串和 SelectParameters 集合中的任何參數,從基礎資料庫擷取資料。

(繼承來源 SqlDataSource)
SetDesignModeState(IDictionary)

設定控制項的設計階段資料。

(繼承來源 Control)
SetRenderMethodDelegate(RenderMethod)

指定事件處理常式委派,以呈現伺服器控制項及其內容至其父控制項。

(繼承來源 Control)
SetTraceData(Object, Object)

使用追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。

(繼承來源 Control)
SetTraceData(Object, Object, Object)

使用追蹤的物體、追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。

(繼承來源 Control)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
TrackViewState()

追蹤 SqlDataSource 控制項的檢視狀態變更,以便變更可以儲存在控制項的 StateBag 物件中。

(繼承來源 SqlDataSource)
Update()

使用 UpdateCommand SQL 字串和 UpdateParameters 集合中的任何參數,執行更新作業。

(繼承來源 SqlDataSource)

事件

DataBinding

發生於伺服器控制項繫結至資料來源時。

(繼承來源 Control)
Deleted

發生於刪除作業已經完成時。

(繼承來源 SqlDataSource)
Deleting

在刪除作業之前發生。

(繼承來源 SqlDataSource)
Disposed

發生於伺服器控制項從記憶體釋放時,這是在要求 ASP.NET 網頁時,伺服器控制項生命週期的最後階段。

(繼承來源 Control)
Filtering

在篩選作業之前發生。

(繼承來源 SqlDataSource)
Init

發生於初始化伺服器控制項時,是其生命週期中的第一個步驟。

(繼承來源 Control)
Inserted

發生於插入作業已經完成時。

(繼承來源 SqlDataSource)
Inserting

在插入作業之前發生。

(繼承來源 SqlDataSource)
Load

發生於載入伺服器控制項至 Page 物件時。

(繼承來源 Control)
PreRender

Control 物件載入之後但在呈現之前發生。

(繼承來源 Control)
Selected

發生於資料擷取作業已經完成時。

(繼承來源 SqlDataSource)
Selecting

在資料擷取作業之前發生。

(繼承來源 SqlDataSource)
Unload

發生於伺服器控制項從記憶體卸載時。

(繼承來源 Control)
Updated

發生於更新作業已經完成時。

(繼承來源 SqlDataSource)
Updating

在更新作業之前發生。

(繼承來源 SqlDataSource)

明確介面實作

IControlBuilderAccessor.ControlBuilder

如需這個成員的說明,請參閱 ControlBuilder

(繼承來源 Control)
IControlDesignerAccessor.GetDesignModeState()

如需這個成員的說明,請參閱 GetDesignModeState()

(繼承來源 Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary)

如需這個成員的說明,請參閱 SetDesignModeState(IDictionary)

(繼承來源 Control)
IControlDesignerAccessor.SetOwnerControl(Control)

如需這個成員的說明,請參閱 SetOwnerControl(Control)

(繼承來源 Control)
IControlDesignerAccessor.UserData

如需這個成員的說明,請參閱 UserData

(繼承來源 Control)
IDataBindingsAccessor.DataBindings

如需這個成員的說明,請參閱 DataBindings

(繼承來源 Control)
IDataBindingsAccessor.HasDataBindings

如需這個成員的說明,請參閱 HasDataBindings

(繼承來源 Control)
IDataSource.DataSourceChanged

當資料來源控制項變更的方式會影響資料繫結控制項時發生。

(繼承來源 DataSourceControl)
IDataSource.GetView(String)

取得與 DataSourceView 控制項關聯的具名 DataSourceControl 物件。 有些資料來源控制項只支援一個檢視,有些則可支援多個檢視。

(繼承來源 DataSourceControl)
IDataSource.GetViewNames()

取得名稱集合,表示與 DataSourceView 控制項關聯的 DataSourceControl 物件清單。

(繼承來源 DataSourceControl)
IExpressionsAccessor.Expressions

如需這個成員的說明,請參閱 Expressions

(繼承來源 Control)
IExpressionsAccessor.HasExpressions

如需這個成員的說明,請參閱 HasExpressions

(繼承來源 Control)
IListSource.ContainsListCollection

指示資料來源控制項是否與一個或多個資料清單產生關聯。

(繼承來源 DataSourceControl)
IListSource.GetList()

取得可以當做資料清單來源使用的資料來源控制項清單。

(繼承來源 DataSourceControl)
IParserAccessor.AddParsedSubObject(Object)

如需這個成員的說明,請參閱 AddParsedSubObject(Object)

(繼承來源 Control)

擴充方法

FindDataSourceControl(Control)

傳回與指定之控制項的資料控制項相關聯的資料來源。

FindFieldTemplate(Control, String)

傳回在指定之控制項的命名容器中所指定資料行的欄位樣板。

FindMetaTable(Control)

傳回包含資料控制項的中繼資料表物件。

GetDefaultValues(IDataSource)

取得所指定資料來源的預設值集合。

GetMetaTable(IDataSource)

取得所指定資料來源物件中的資料表中繼資料。

TryGetMetaTable(IDataSource, MetaTable)

判斷資料表中繼資料是否可供使用。

適用於

另請參閱