OleDbParameterCollection クラスとは? わかりやすく解説

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

OleDbParameterCollection クラス

OleDbCommand に関連するパラメータ コレクション、および DataSet 列に対する各パラメータマップ表します

名前空間: System.Data.OleDb
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public NotInheritable Class
 OleDbParameterCollection
    Inherits DbParameterCollection
Dim instance As OleDbParameterCollection
public sealed class OleDbParameterCollection
 : DbParameterCollection
public ref class OleDbParameterCollection sealed
 : public DbParameterCollection
public final class OleDbParameterCollection
 extends DbParameterCollection
public final class OleDbParameterCollection
 extends DbParameterCollection
解説解説
使用例使用例

OleDbDataAdapter の OleDbParameterCollection コレクション使用して、OleDbParameter の複数インスタンス作成する例を次に示します。これらのパラメータ使用してデータ ソース内のデータ選択しDataSetデータ格納します。この例では、DataSet および OleDbDataAdapter が、適切なスキーマコマンド、および接続で既に作成されていることを前提にしています。

Public Function GetDataSetFromAdapter( _
    ByVal dataSet As DataSet, ByVal
 connectionString As String, _
    ByVal queryString As String)
 As DataSet

    Using connection As New OleDbConnection(connectionString)
        Dim adapter As New
 OleDbDataAdapter(queryString, connection)

        ' Set the parameters.
        adapter.SelectCommand.Parameters.Add( _
            "@CategoryName", OleDbType.VarChar, 80).Value
 = "toasters"
        adapter.SelectCommand.Parameters.Add( _
         "@SerialNum", OleDbType.Integer).Value =
 239

        ' Open the connection and fill the DataSet.
        Try
            connection.Open()
            adapter.Fill(dataSet)
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
        ' The connection is automatically closed when the
        ' code exits the Using block.
    End Using

    Return dataSet
End Function
public DataSet GetDataSetFromAdapter(
    DataSet dataSet, string connectionString, string
 queryString)
{
    using (OleDbConnection connection =
               new OleDbConnection(connectionString))
    {
        OleDbDataAdapter adapter =
            new OleDbDataAdapter(queryString, connection);

        // Set the parameters.
        adapter.SelectCommand.Parameters.Add(
            "@CategoryName", OleDbType.VarChar, 80).Value = "toasters";
        adapter.SelectCommand.Parameters.Add(
            "@SerialNum", OleDbType.Integer).Value = 239;

        // Open the connection and fill the DataSet.
        try
        {
            connection.Open();
            adapter.Fill(dataSet);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        // The connection is automatically closed when the
        // code exits the using block.
    }
    return dataSet;
}
using System;
using System.Data;
using System.Data.OleDb;

class Class1
{
    static void Main()
    {
        //        string x = "Provider=SQLOLEDB;Data Source=(local);Integrated
 Security=SSPI;Initial Catalog=Northwind";
    }

    public DataSet GetDataSetFromAdapter(
        DataSet dataSet, string connectionString, string
 queryString)
    {
        using (OleDbConnection connection =
                   new OleDbConnection(connectionString))
        {
            OleDbDataAdapter adapter =
                new OleDbDataAdapter(queryString, connection);

            // Set the parameters.
            adapter.SelectCommand.Parameters.Add(
                "@CategoryName", OleDbType.VarChar, 80).Value = "toasters";
            adapter.SelectCommand.Parameters.Add(
                "@SerialNum", OleDbType.Integer).Value = 239;

            // Open the connection and fill the DataSet.
            try
            {
                connection.Open();
                adapter.Fill(dataSet);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            // The connection is automatically closed when the
            // code exits the using block.
        }
        return dataSet;
    }
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.Data.Common.DbParameterCollection
      System.Data.OleDb.OleDbParameterCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
OleDbParameterCollection メンバ
System.Data.OleDb 名前空間
その他の技術情報
コマンド使用
DataAdapter によるパラメータ使用



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

辞書ショートカット

すべての辞書の索引

「OleDbParameterCollection クラス」の関連用語

OleDbParameterCollection クラスのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS