次の方法で共有


SqlCeCommand コンストラクター (String, SqlCeConnection)

クエリ テキストと SqlCeConnection を指定して、SqlCeCommand クラスの新しいインスタンスを初期化します。

名前空間:  System.Data.SqlServerCe
アセンブリ:  System.Data.SqlServerCe (System.Data.SqlServerCe.dll)

構文

'宣言
Public Sub New ( _
    commandText As String, _
    connection As SqlCeConnection _
)
'使用
Dim commandText As String
Dim connection As SqlCeConnection

Dim instance As New SqlCeCommand(commandText, _
    connection)
public SqlCeCommand(
    string commandText,
    SqlCeConnection connection
)
public:
SqlCeCommand(
    String^ commandText, 
    SqlCeConnection^ connection
)
new : 
        commandText:string * 
        connection:SqlCeConnection -> SqlCeCommand
public function SqlCeCommand(
    commandText : String, 
    connection : SqlCeConnection
)

パラメーター

説明

SqlCeCommand のインスタンスの初期プロパティ値を次の表に示します。

プロパティ

初期値

CommandText

cmdText

CommandType

Text

Connection

connection パラメーターの値である新しい SqlCeConnection

これらのパラメーターの値は、関連するプロパティを設定することによって変更できます。

使用例

SqlCeCommand を作成し、そのプロパティの一部を設定する例を次に示します。

conn.Open()
Dim cmd As New SqlCeCommand("INSERT INTO foo (col1) VALUES (1)", conn)
cmd.ExecuteNonQuery()
conn.Close()
conn.Open();
SqlCeCommand cmd = new SqlCeCommand("INSERT INTO foo (col1) VALUES (1)", conn);
cmd.ExecuteNonQuery();
conn.Close();

関連項目

参照

SqlCeCommand クラス

SqlCeCommand オーバーロード

System.Data.SqlServerCe 名前空間