AccessDataSource コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > AccessDataSource コンストラクタの意味・解説 

AccessDataSource コンストラクタ

AccessDataSource クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

AccessDataSource クラス
AccessDataSource メンバ
System.Web.UI.WebControls 名前空間

AccessDataSource コンストラクタ (String, String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

データ ファイルパスSelect コマンド指定して、AccessDataSource クラス新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    dataFile As String, _
    selectCommand As String _
)
Dim dataFile As String
Dim selectCommand As String

Dim instance As New AccessDataSource(dataFile,
 selectCommand)
public AccessDataSource (
    string dataFile,
    string selectCommand
)
public:
AccessDataSource (
    String^ dataFile, 
    String^ selectCommand
)
public AccessDataSource (
    String dataFile, 
    String selectCommand
)
public function AccessDataSource (
    dataFile : String, 
    selectCommand : String
)

パラメータ

dataFile

Access .mdb ファイル位置この位置には、現在の Web フォームフォルダへの相対的な位置絶対物理パス、または仮想パス指定できます

selectCommand

Access データベースからデータ取得するために使用する SQL クエリSQL クエリパラメータ化された SQL 文字列場合は、Parameter オブジェクトを SelectParameters コレクション追加します

使用例使用例

AccessDataSource コンストラクタ使用して新しAccessDataSource データ ソース コントロール作成し、CheckBoxList コントロールMicrosoft Access データベースデータバインドする方法次のコード例示します

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

<SCRIPT runat="server">
Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)

  ' Create AccessDataSource
  Dim accessDS As New AccessDataSource("~/App_Data/Northwind.mdb",
 _
                                       "SELECT SupplierID, CompanyName
 " & _
                                      " FROM Suppliers WHERE Country ='Germany'")

  ' Add the AccessDataSource to the Page.Controls collection
  Page.Controls.Add(accessDS)

  ' In programmatic scenarios, use the DataSource
  ' property, not the DataSourceID property. The Select method
  ' returns an IEnumerable list of data items.
  CheckBoxList1.DataSource = accessDS

  ' Explicitly call DataBind
  CheckBoxList1.DataBind()

End Sub 'Page_Load
</SCRIPT>

<HTML>
  <BODY>
    <FORM runat="server">

      <asp:CheckBoxList
        id="CheckBoxList1"
        runat="server"
        DataTextField="CompanyName"
        DataValueField="SupplierID">
      </asp:CheckBoxList>

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

<SCRIPT runat="server">
private void Page_Load(Object sender, EventArgs
 e) {

  // Create AccessDataSource
  AccessDataSource accessDS =
    new AccessDataSource("~/App_Data/Northwind.mdb"
,
                         "SELECT SupplierID, CompanyName " +
                         " FROM Suppliers WHERE Country ='Germany'");

  // Add the AccessDataSource to the Page.Controls collection
  Page.Controls.Add(accessDS);

  // In programmatic scenarios, use the DataSource
  // property, not the DataSourceID property. The Select method
  // returns an IEnumerable list of data items.
  CheckBoxList1.DataSource = accessDS;

  // Explicitly call DataBind
  CheckBoxList1.DataBind();
}
</SCRIPT>

<HTML>
  <BODY>
    <FORM runat="server">

      <asp:CheckBoxList
        id="CheckBoxList1"
        runat="server"
        DataTextField="CompanyName"
        DataValueField="SupplierID">
      </asp:CheckBoxList>

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

<SCRIPT runat="server">
    private void Page_Load(Object sender, System.EventArgs
 e) 
    {
        // Create AccessDataSource
        AccessDataSource accessDS =    new AccessDataSource(
            "~/App_Data/Northwind.mdb","SELECT SupplierID, CompanyName
 "
            +" FROM Suppliers WHERE Country ='Germany'");

        // Add the AccessDataSource to the Page.Controls collection
        get_Page().get_Controls().Add(accessDS);

        // In programmatic scenarios, use the DataSource
        // property, not the DataSourceID property. The Select method
        // returns an IEnumerable list of data items.
        CheckBoxList1.set_DataSource ( accessDS);

        // Explicitly call DataBind
        CheckBoxList1.DataBind();
    }//Page_Load
</SCRIPT>

<HTML>
  <BODY>
    <FORM runat="server">

      <asp:CheckBoxList
        id="CheckBoxList1"
        runat="server"
        DataTextField="CompanyName"
        DataValueField="SupplierID">
      </asp:CheckBoxList>

    </FORM>
  </BODY>
</HTML>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AccessDataSource クラス
AccessDataSource メンバ
System.Web.UI.WebControls 名前空間
DataFile
SelectCommand
SelectParameters

AccessDataSource コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

AccessDataSource クラス新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Dim instance As New AccessDataSource
public AccessDataSource ()
public:
AccessDataSource ()
public AccessDataSource ()
public function AccessDataSource ()
使用例使用例

AccessDataSource コンストラクタ使用して新しAccessDataSource データ ソース コントロール作成し、CheckBoxList コントロールMicrosoft Access データベースデータバインドする方法次のコード例示します

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

<SCRIPT runat="server">
Sub Page_Load(ByVal sender As
 Object, ByVal e As EventArgs)

  ' Create the AccessDataSource.
  Dim accessDS As New AccessDataSource()
  accessDS.SelectCommand = "SELECT SupplierID, CompanyName "
 & _
                           " FROM Suppliers WHERE Country ='Germany'"
  accessDS.DataFile = "~/App_Data/Northwind.mdb"

  ' Add the AccessDataSource to the Page.Controls collection.
  Page.Controls.Add(accessDS)

  ' In programmatic scenarios, use the DataSource
  ' property, not the DataSourceID property. The Select method
  ' returns an IEnumerable list of data items.
  CheckBoxList1.DataSource = accessDS

  ' Explicitly call DataBind.
  CheckBoxList1.DataBind()

End Sub 'Page_Load
</SCRIPT>

<HTML>
  <BODY>
    <FORM runat="server">

      <asp:CheckBoxList
        id="CheckBoxList1"
        runat="server"
        DataTextField="CompanyName"
        DataValueField="SupplierID">
      </asp:CheckBoxList>

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

<SCRIPT runat="server">
private void Page_Load(Object sender, EventArgs
 e) {

  // Create the AccessDataSource.
  AccessDataSource accessDS = new AccessDataSource();
  accessDS.SelectCommand = "SELECT SupplierID, CompanyName " +
                           " FROM Suppliers WHERE Country ='Germany'";
  accessDS.DataFile = "~/App_Data/Northwind.mdb";

  // Add the AccessDataSource to the Page.Controls collection.
  Page.Controls.Add(accessDS);

  // In programmatic scenarios, use the DataSource
  // property, not the DataSourceID property. The Select method
  // returns an IEnumerable list of data items.
  CheckBoxList1.DataSource = accessDS;

  // Explicitly call DataBind.
  CheckBoxList1.DataBind();
}
</SCRIPT>

<HTML>
  <BODY>
    <FORM runat="server">

      <asp:CheckBoxList
        id="CheckBoxList1"
        runat="server"
        DataTextField="CompanyName"
        DataValueField="SupplierID">
      </asp:CheckBoxList>

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

<SCRIPT runat="server">
    private void Page_Load(Object sender, System.EventArgs
 e)
    {
        // Create the AccessDataSource.
        AccessDataSource accessDS = new AccessDataSource();

        accessDS.set_SelectCommand ("SELECT SupplierID, CompanyName "
            + "FROM Suppliers WHERE Country ='Germany'");
        accessDS.set_DataFile ( "~/App_Data/Northwind.mdb");

        // Add the AccessDataSource to the Page.Controls
        // collection.AccessDataSourceAccessDataSourceAccessDataSource
        get_Page().get_Controls().Add(accessDS);

        // In programmatic scenarios, use the DataSource
        // property, not the DataSourceID property. The Select method
        // returns an IEnumerable list of data items.
        CheckBoxList1.set_DataSource(accessDS);

        // Explicitly call DataBind.
        CheckBoxList1.DataBind();
    }//Page_Load

</SCRIPT>

<HTML>
  <BODY>
    <FORM runat="server">

      <asp:CheckBoxList
        id="CheckBoxList1"
        runat="server"
        DataTextField="CompanyName"
        DataValueField="SupplierID">
      </asp:CheckBoxList>

    </FORM>
  </BODY>
</HTML>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AccessDataSource クラス
AccessDataSource メンバ
System.Web.UI.WebControls 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「AccessDataSource コンストラクタ」の関連用語

AccessDataSource コンストラクタのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



AccessDataSource コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS