SqlCeCommand コンストラクタ (String)
アセンブリ: System.Data.SqlServerCe (system.data.sqlserverce.dll 内)
構文
解説
SqlCeCommand のインスタンスの初期プロパティ値を次の表に示します。
CommandText | cmdText |
CommandType | |
null 参照 (Visual Basic では Nothing) |
プラットフォーム
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
SqlCeCommand コンストラクタ (String, SqlCeConnection)
アセンブリ: 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 )
public SqlCeCommand ( String commandText, SqlCeConnection connection )
public function SqlCeCommand ( commandText : String, connection : SqlCeConnection )
SqlCeCommand のインスタンスの初期プロパティ値を次の表に示します。
CommandText | cmdText |
CommandType | |
connection パラメータの値である新しい SqlCeConnection。 |
プラットフォーム
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
SqlCeCommand コンストラクタ (String, SqlCeConnection, SqlCeTransaction)
アセンブリ: System.Data.SqlServerCe (system.data.sqlserverce.dll 内)
構文
Public Sub New ( _ commandText As String, _ connection As SqlCeConnection, _ transaction As SqlCeTransaction _ )
Dim commandText As String Dim connection As SqlCeConnection Dim transaction As SqlCeTransaction Dim instance As New SqlCeCommand(commandText, connection, transaction)
public SqlCeCommand ( string commandText, SqlCeConnection connection, SqlCeTransaction transaction )
public: SqlCeCommand ( String^ commandText, SqlCeConnection^ connection, SqlCeTransaction^ transaction )
public SqlCeCommand ( String commandText, SqlCeConnection connection, SqlCeTransaction transaction )
public function SqlCeCommand ( commandText : String, connection : SqlCeConnection, transaction : SqlCeTransaction )
SqlCeCommand のインスタンスの初期プロパティ値を次の表に示します。
CommandText | cmdText |
CommandType | |
connection パラメータの値である新しい SqlCeConnection。 |
SqlCeCommand を作成し、そのプロパティの一部を設定する例を次に示します。
Dim cmdText As String = "INSERT INTO FactSalesQuota " & _ "(EmployeeKey, TimeKey, SalesAmountQuota) " & _ "VALUES (2, 1158, 150000.00)" Dim conn As New SqlCeConnection("Data Source = AdventureWorks.sdf;") conn.Open() ' Start a local transaction; SQL Mobile supports the following ' isolation levels: ReadCommitted, RepeatableRead, Serializable ' Dim tx As SqlCeTransaction = conn.BeginTransaction(IsolationLevel.ReadCommitted) ' By default, commands run in auto-commit mode; ' Dim cmd As New SqlCeCommand(cmdText, conn, tx) Try cmd.ExecuteNonQuery() ' Commit the changes to disk if everything above succeeded; ' Use Deferred mode for optimal performance; the changes will ' be flashed to disk within the timespan specified in the ' ConnectionString 'FLUSH INTERVAL' property; ' tx.Commit(CommitMode.Deferred) ' Alternatively, you could use: ' tx.Commit(CommitMode.Immediate); ' ' or use default (Deferred) commit mode: ' tx.Commit() Catch e As Exception ' Handle errors here ' tx.Rollback() Finally conn.Close() End Try
string cmdText = "INSERT INTO FactSalesQuota " + "(EmployeeKey, TimeKey, SalesAmountQuota) " + "VALUES (2, 1158, 150000.00)"; SqlCeConnection conn = new SqlCeConnection("Data Source = AdventureWorks.sdf;"); conn.Open(); // Start a local transaction; SQL Mobile supports the following // isolation levels: ReadCommitted, RepeatableRead, Serializable // SqlCeTransaction tx = conn.BeginTransaction(IsolationLevel.ReadCommitted); SqlCeCommand cmd = new SqlCeCommand(cmdText, conn, tx); try { cmd.ExecuteNonQuery(); // Commit the changes to disk if everything above succeeded; // Use Deferred mode for optimal performance; the changes will // be flushed to disk within the timespan specified in the // ConnectionString 'FLUSH INTERVAL' property; // tx.Commit(CommitMode.Deferred); // Alternatively, you could use: // tx.Commit(CommitMode.Immediate); // // or use default (Deferred) commit mode: // tx.Commit() } catch (Exception) { // Handle errors here // tx.Rollback(); } finally { conn.Close(); }
プラットフォーム
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
SqlCeCommand コンストラクタ
オーバーロードの一覧
名前 | 説明 |
---|---|
SqlCeCommand () | SqlCeCommand クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
SqlCeCommand (String) | クエリ テキストを指定して、SqlCeCommand クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
SqlCeCommand (String, SqlCeConnection) | クエリ テキストと SqlCeConnection を指定して、SqlCeCommand クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
SqlCeCommand (String, SqlCeConnection, SqlCeTransaction) | クエリ テキスト、SqlCeConnection、および SqlCeTransaction を指定して、SqlCeCommand クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
SqlCeCommand コンストラクタ ()
アセンブリ: System.Data.SqlServerCe (system.data.sqlserverce.dll 内)
構文
解説
基本コンストラクタは、すべてのフィールドを既定値に初期化します。SqlCeCommand のインスタンスの初期プロパティ値を次の表に示します。
CommandText | 空の文字列 ("") |
CommandType | |
null 参照 (Visual Basic では Nothing) |
プラットフォーム
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- SqlCeCommand コンストラクタのページへのリンク