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 資料庫中的數據會顯示在 GridView 控件中。 因為也會指定 UpdateCommand 屬性,而且 AutoGenerateEditButton 屬性設定為 true,因此您可以編輯和更新記錄,而不需要額外的程式代碼。 GridView 控件會處理將參數新增至 UpdateParameters 集合;GridView 控件會先傳遞 BoundField 對象的參數值,後面接著由 DataKeyNames 屬性指定的欄位值。 GridView 會自動呼叫 Update 方法。 如果您想要明確排序參數,請在 UpdateParameters上指定 AccessDataSource 集合。

<%@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 資料庫搭配使用。 如同其基類,SqlDataSourceAccessDataSource 控件會使用 SQL 查詢來執行數據擷取。

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

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

您可以使用數據綁定控件的 AccessDataSource 屬性,將數據綁定控件系結至 DataSourceID。 如需將數據綁定控件系結至數據源控件的詳細資訊,請參閱使用數據源控件系結至數據。

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

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

下表說明了對 AccessDataSource 照的特性。

能力 Requirements
排序 將屬性設定DataSourceModeDataSet
篩選 將該屬性設定 FilterExpression 為用於呼叫該方法時過濾資料 Select 的過濾表達式。
Paging AccessDataSource 不支援 Access 資料庫的直接分頁作業。 如果 GridView 屬性設定為 AccessDataSource 值,數據綁定控件,例如 DataSourceMode,可以逐頁流覽 DataSet所傳回的專案。
更新中 UpdateCommand 屬性設定為用來更新數據的 SQL 語句。 此陳述通常有參數化。
刪除中 DeleteCommand 屬性設定為用來刪除資料的 SQL 語句。 此陳述通常有參數化。
插入 InsertCommand 屬性設定為用來插入數據的 SQL 語句。 此陳述通常有參數化。
Caching 根據你想要快取資料的快取行為,將屬性設為 值DataSourceModeDataSet屬性設為 EnableCachingtrue然後設定 CacheDurationCacheExpirationPolicy屬性。

如同所有數據源控件,AccessDataSource 控件與強型別數據源檢視類別相關聯。 就像 AccessDataSource 控件延伸 SqlDataSource 控件一樣,AccessDataSourceView 類別會擴充 SqlDataSourceView 類別。 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>

建構函式

名稱 Description
AccessDataSource()

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

AccessDataSource(String, String)

使用指定的數據文件路徑,並 AccessDataSource 命令,初始化 類別的新實例。

屬性

名稱 Description
Adapter

拿到瀏覽器專用的控制器轉接器。

(繼承來源 Control)
AppRelativeTemplateSourceDirectory

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

(繼承來源 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

取得 HttpContext 與伺服器控制項相關聯的物件,用於目前的網頁請求。

(繼承來源 Control)
Controls

取得 ControlCollection 一個物件,代表 UI 階層中指定伺服器控制項的子控制項。

(繼承來源 DataSourceControl)
DataFile

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

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

會取得一個事件處理代理清單來管理控制。 這個屬性是唯讀的。

(繼承來源 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() or Update() 方法的任何參數名稱套用。

(繼承來源 SqlDataSource)
Page

會取得包含 Page 伺服器控制的實例參考。

(繼承來源 Control)
Parent

在頁面控制階層中,會取得伺服器控制項的父控制權的參考。

(繼承來源 Control)
ProviderName

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

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

取得包含當前伺服器控制權的 or Page 虛擬目錄UserControl

(繼承來源 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)

方法

名稱 Description
AddedControl(Control, Int32)

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

(繼承來源 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()

將目前控制實例及任何子控制的屬性設定 ClientIDModeInherit

(繼承來源 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, Int32)

搜尋目前的命名容器,使用指定的 id 與參數中 pathOffset 指定的整數,協助搜尋。 你不應該覆蓋這個版本的方法 FindControl

(繼承來源 Control)
FindControl(String)

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

(繼承來源 DataSourceControl)
Focus()

將輸入焦點設定在控制器上。

(繼承來源 DataSourceControl)
GetDbProviderFactory()

擷取與 DbProviderFactory 屬性所識別之 .NET 數據提供者相關聯的 ProviderName 物件。

GetDesignModeState()

取得設計時數據以支援控制。

(繼承來源 Control)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetRouteUrl(Object)

取得對應一組路由參數的網址。

(繼承來源 Control)
GetRouteUrl(RouteValueDictionary)

取得對應一組路由參數的網址。

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

取得對應一組路由參數和路由名稱的 URL。

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

取得對應一組路由參數和路由名稱的 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)

在子控制從物件集合ControlsControl移除後呼叫。

(繼承來源 Control)
Render(HtmlTextWriter)

將伺服器控制內容傳送給所提供的 HtmlTextWriter 物件,該物件會寫入要在用戶端渲染的內容。

(繼承來源 Control)
RenderChildren(HtmlTextWriter)

將伺服器控制子節點的內容輸出到所提供 HtmlTextWriter 物件,該物件會寫入要在用戶端渲染的內容。

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

伺服器控制內容輸出給所提供的 HtmlTextWriter 物件,使用該物件 ControlAdapter

(繼承來源 Control)
RenderControl(HtmlTextWriter)

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

(繼承來源 DataSourceControl)
ResolveAdapter()

取得負責渲染指定控制的控制介面卡。

(繼承來源 Control)
ResolveClientUrl(String)

會取得瀏覽器可以使用的網址。

(繼承來源 Control)
ResolveUrl(String)

將一個網址轉換成請求客戶端可用的網址。

(繼承來源 Control)
SaveControlState()

將自頁面發布以來發生的任何伺服器控制狀態變更,都儲存回伺服器。

(繼承來源 Control)
SaveViewState()

保存控制的當前視圖狀態 SqlDataSource

(繼承來源 SqlDataSource)
Select(DataSourceSelectArguments)

利用 SelectCommand SQL 字串及集合中 SelectParameters 的任何參數,從底層資料庫擷取資料。

(繼承來源 SqlDataSource)
SetDesignModeState(IDictionary)

為控制組設定設計時資料。

(繼承來源 Control)
SetRenderMethodDelegate(RenderMethod)

指派一個事件處理代理,將伺服器控制權及其內容渲染到其父控制中。

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

設定追蹤資料,用於設計時追蹤渲染資料,使用追蹤物件、追蹤資料鍵及追蹤資料值。

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

使用軌跡資料鍵與痕跡資料值,設定繪圖資料以進行設計時追蹤渲染資料。

(繼承來源 Control)
ToString()

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

(繼承來源 Object)
TrackViewState()

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

(繼承來源 SqlDataSource)
Update()

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

(繼承來源 SqlDataSource)

事件

名稱 Description
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)

明確介面實作

名稱 Description
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)

擴充方法

名稱 Description
FindDataSourceControl(Control)

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

FindFieldTemplate(Control, String)

回傳指定控制項命名容器中指定欄位的欄位範本。

FindMetaTable(Control)

回傳包含資料控制項的元值物件。

GetDefaultValues(IDataSource)

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

GetMetaTable(IDataSource)

取得指定資料來源物件中某個資料表的元資料。

TryGetMetaTable(IDataSource, MetaTable)

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

適用於

另請參閱