AccessDataSource 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表用於資料綁定控制的 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 資料庫搭配使用。 如同其基類,SqlDataSource,AccessDataSource 控件會使用 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 語句中的參數順序相當重要;您在 SelectCommand、UpdateCommand、InsertCommand和 DeleteCommand 屬性中指定的任何參數化 SQL 查詢,都必須符合對應參數集合中任何 Parameter 對象的順序。 如果在 AccessDataSource上未指定任何參數集合,則提供給這些作業的參數順序必須符合它們出現在基礎 SQL 語句中的順序。 如需詳細資訊,請參閱 搭配 SqlDataSource 控制項使用參數。
AccessDataSource 控件支援其基類支援的相同快取行為。 使用快取來增加使用 AccessDataSource 控件的頁面效能。 如需資料來源快取的詳細資訊,請參閱 使用資料源控件快取資料。
下表說明了對 AccessDataSource 照的特性。
| 能力 | Requirements |
|---|---|
| 排序 | 將屬性設定DataSourceMode為DataSet |
| 篩選 | 將該屬性設定 FilterExpression 為用於呼叫該方法時過濾資料 Select 的過濾表達式。 |
| Paging | AccessDataSource 不支援 Access 資料庫的直接分頁作業。 如果 GridView 屬性設定為 AccessDataSource 值,數據綁定控件,例如 DataSourceMode,可以逐頁流覽 DataSet所傳回的專案。 |
| 更新中 | 將 UpdateCommand 屬性設定為用來更新數據的 SQL 語句。 此陳述通常有參數化。 |
| 刪除中 | 將 DeleteCommand 屬性設定為用來刪除資料的 SQL 語句。 此陳述通常有參數化。 |
| 插入 | 將 InsertCommand 屬性設定為用來插入數據的 SQL 語句。 此陳述通常有參數化。 |
| Caching | 根據你想要快取資料的快取行為,將屬性設為 值DataSourceMode,DataSet屬性設為 EnableCaching,true然後設定 CacheDuration 與CacheExpirationPolicy屬性。 |
如同所有數據源控件,AccessDataSource 控件與強型別數據源檢視類別相關聯。 就像 AccessDataSource 控件延伸 SqlDataSource 控件一樣,AccessDataSourceView 類別會擴充 SqlDataSourceView 類別。 AccessDataSourceView 類別會覆寫幾個 SqlDataSourceView 方法,以使用 System.Data.OleDb .NET 數據提供者。
沒有 AccessDataSource 控件的視覺轉譯;它會實作為控件,以啟用宣告式持續性,並選擇性地允許參與狀態管理。 因此,您無法設定支援視覺功能的屬性,例如 EnableTheming 和 SkinID 屬性。
宣告式語法
<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 包含的任何參數值為 |
| 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 |
|---|---|
| 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 |
|---|---|
| FindDataSourceControl(Control) |
回傳與指定控制項相關聯的資料來源。 |
| FindFieldTemplate(Control, String) |
回傳指定控制項命名容器中指定欄位的欄位範本。 |
| FindMetaTable(Control) |
回傳包含資料控制項的元值物件。 |
| GetDefaultValues(IDataSource) |
取得指定資料來源的預設值集合。 |
| GetMetaTable(IDataSource) |
取得指定資料來源物件中某個資料表的元資料。 |
| TryGetMetaTable(IDataSource, MetaTable) |
判斷表格中繼資料是否可用。 |