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

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

SqlCeCommand コンストラクタ (String)

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

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

Public Sub New ( _
    commandText As String _
)
Dim commandText As String

Dim instance As New SqlCeCommand(commandText)
public SqlCeCommand (
    string commandText
)
public:
SqlCeCommand (
    String^ commandText
)
public SqlCeCommand (
    String commandText
)
public function SqlCeCommand (
    commandText : String
)

パラメータ

commandText

クエリ テキスト

解説解説

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

プロパティ

初期値

CommandText

cmdText

CommandType

Text

Connection

null 参照 (Visual Basic では Nothing)

使用例使用例

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

Dim queryText As String
 = "SELECT * FROM Categories ORDER BY [Category ID]"
Dim cmd As New SqlCeCommand(queryText)

cmd.Connection = conn
cmd.CommandType = CommandType.Text
string queryText = "SELECT * FROM Categories ORDER BY [Category
 ID]";
SqlCeCommand cmd = new SqlCeCommand(queryText);

cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlCeCommand クラス
SqlCeCommand メンバ
System.Data.SqlServerCe 名前空間

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
)
public SqlCeCommand (
    String commandText, 
    SqlCeConnection connection
)
public function SqlCeCommand (
    commandText : String, 
    connection : SqlCeConnection
)

パラメータ

commandText

クエリ テキスト

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();
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlCeCommand クラス
SqlCeCommand メンバ
System.Data.SqlServerCe 名前空間

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

クエリ テキストSqlCeConnection、および SqlCeTransaction を指定してSqlCeCommand クラス新しインスタンス初期化します。

名前空間: System.Data.SqlServerCe
アセンブリ: 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
)

パラメータ

commandText

クエリ テキスト

connection

データ ソースへの接続を表す SqlCeConnection。

transaction

SqlCeCommand を実行するトランザクション

解説解説

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

プロパティ

初期値

CommandText

cmdText

CommandType

Text

Connection

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();
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlCeCommand クラス
SqlCeCommand メンバ
System.Data.SqlServerCe 名前空間

SqlCeCommand コンストラクタ

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 クラス
SqlCeCommand メンバ
System.Data.SqlServerCe 名前空間

SqlCeCommand コンストラクタ ()

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

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

public SqlCeCommand ()
public:
SqlCeCommand ()
public SqlCeCommand ()
public function SqlCeCommand ()
解説解説
使用例使用例

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

Dim cmd As SqlCeCommand = conn.CreateCommand()
cmd.CommandText = "SELECT * FROM Categories ORDER BY CategoryID"
cmd.CommandType = CommandType.Text
cmd.UpdatedRowSource = UpdateRowSource.Both
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM Categories ORDER BY CategoryID";
cmd.CommandType = CommandType.Text;
cmd.UpdatedRowSource = UpdateRowSource.Both;
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlCeCommand クラス
SqlCeCommand メンバ
System.Data.SqlServerCe 名前空間



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

辞書ショートカット

すべての辞書の索引

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

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

   

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



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

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

©2024 GRAS Group, Inc.RSS