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

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

SqlCeParameterCollection クラス

SqlCeCommand に関連するすべてのパラメータ、および DataSet 列に対する各パラメータマップ収集します

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

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

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

Dim cmd As SqlCeCommand = Nothing
Dim adp As SqlCeDataAdapter = Nothing

Try
    adp = New SqlCeDataAdapter()
    Dim conn As New SqlCeConnection("Data
 Source = MyDatabase.sdf")

    ' Create the SelectCommand
    '
    cmd = conn.CreateCommand()
    cmd.CommandText = "SELECT * FROM Orders WHERE [Ship Country]
 = @country AND [Ship City] = @city"
    cmd.Parameters.Add("@country", SqlDbType.NVarChar,
 15)
    cmd.Parameters.Add("@city", SqlDbType.NVarChar,
 15)

    cmd.Parameters("@country").Value = "UK"
    cmd.Parameters("@city").Value = "London"

    adp.SelectCommand = cmd

    ' Create the DeleteCommand
    '
    cmd = conn.CreateCommand()
    cmd.CommandText = "DELETE FROM Orders WHERE [Order ID] = @orderID"

    Dim p As SqlCeParameter = cmd.Parameters.Add("@orderID",
 SqlDbType.NChar, 5, "Order ID")
    p.SourceVersion = DataRowVersion.Original

    adp.DeleteCommand = cmd

    ' Populate the dataset with the results from the SELECT statement
    '
    Dim ds As New DataSet()
    adp.Fill(ds)

    ' Modify the dataset
    '
    MessageBox.Show("Number of rows: " & ds.Tables(0).Rows.Count)

    ' Delete some rows
    '
    ds.Tables(0).Rows(3).Delete()
    ds.Tables(0).Rows(4).Delete()

    ' This will execute two DELETE statements 
    '
    adp.Update(ds.Tables(0))
Catch e As Exception
    MessageBox.Show(e.Message)
Finally
    If Not Nothing Is
 adp.SelectCommand Then
        adp.SelectCommand.Dispose()
    End If
    If Not Nothing Is
 adp.DeleteCommand Then
        adp.DeleteCommand.Dispose()
    End If
End Try
SqlCeCommand cmd = null;
SqlCeDataAdapter adp = null;

try
{
    adp = new SqlCeDataAdapter();
    SqlCeConnection conn = new SqlCeConnection("Data Source
 = MyDatabase.sdf");

    // Create the SelectCommand
    //
    cmd = conn.CreateCommand();
    cmd.CommandText = "SELECT * FROM Orders WHERE [Ship Country] = @country
 AND [Ship City] = @city";
    cmd.Parameters.Add("@country", SqlDbType.NVarChar, 15);
    cmd.Parameters.Add("@city", SqlDbType.NVarChar, 15);

    cmd.Parameters["@country"].Value = "UK";
    cmd.Parameters["@city"].Value = "London";

    adp.SelectCommand = cmd;

    // Create the DeleteCommand
    //
    cmd = conn.CreateCommand();
    cmd.CommandText = "DELETE FROM Orders WHERE [Order ID] = @orderID";

    SqlCeParameter p = cmd.Parameters.Add("@orderID", SqlDbType.NChar,
 5, "Order ID");
    p.SourceVersion = DataRowVersion.Original;

    adp.DeleteCommand = cmd;

    // Populate the dataset with the results from the SELECT statement
    //
    DataSet ds = new DataSet();
    adp.Fill(ds);

    // Modify the dataset
    //
    MessageBox.Show("Number of rows: " + ds.Tables[0].Rows.Count);

    // Delete some rows
    //
    ds.Tables[0].Rows[3].Delete();
    ds.Tables[0].Rows[4].Delete();

    // This will execute two DELETE statements 
    //
    adp.Update(ds.Tables[0]);
}
catch (Exception e)
{
    MessageBox.Show(e.Message);
}
finally
{
    if (null != adp.SelectCommand) adp.SelectCommand.Dispose();
    if (null != adp.DeleteCommand) adp.DeleteCommand.Dispose();
}
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.Data.Common.DbParameterCollection
      System.Data.SqlServerCe.SqlCeParameterCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlCeParameterCollection メンバ
System.Data.SqlServerCe 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からSqlCeParameterCollection クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSqlCeParameterCollection クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSqlCeParameterCollection クラス を検索

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

辞書ショートカット

すべての辞書の索引

「SqlCeParameterCollection クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS