SqlCommand コンストラクタ ()
アセンブリ: System.Data (system.data.dll 内)
構文
解説
使用例
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
SqlCommand コンストラクタ (String, SqlConnection, SqlTransaction)
アセンブリ: System.Data (system.data.dll 内)
構文
Public Sub New ( _ cmdText As String, _ connection As SqlConnection, _ transaction As SqlTransaction _ )
Dim cmdText As String Dim connection As SqlConnection Dim transaction As SqlTransaction Dim instance As New SqlCommand(cmdText, connection, transaction)
public SqlCommand ( string cmdText, SqlConnection connection, SqlTransaction transaction )
public: SqlCommand ( String^ cmdText, SqlConnection^ connection, SqlTransaction^ transaction )
public SqlCommand ( String cmdText, SqlConnection connection, SqlTransaction transaction )
public function SqlCommand ( cmdText : String, connection : SqlConnection, transaction : SqlTransaction )
- connection
SQL Server のインスタンスへの接続を表す SqlConnection。
SqlCommand のインスタンスの初期プロパティ値を次の表に示します。
CommandText | cmdText |
CommandTimeout | |
CommandType | CommandType.Text |
connection パラメータの値である新しい SqlConnection。 |
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
SqlCommand コンストラクタ (String, SqlConnection)
アセンブリ: System.Data (system.data.dll 内)
構文
Public Sub New ( _ cmdText As String, _ connection As SqlConnection _ )
Dim cmdText As String Dim connection As SqlConnection Dim instance As New SqlCommand(cmdText, connection)
public SqlCommand ( string cmdText, SqlConnection connection )
public: SqlCommand ( String^ cmdText, SqlConnection^ connection )
public SqlCommand ( String cmdText, SqlConnection connection )
public function SqlCommand ( cmdText : String, connection : SqlConnection )
- connection
SQL Server のインスタンスへの接続を表す SqlConnection。
SqlCommand のインスタンスの初期プロパティ値を次の表に示します。
CommandText | cmdText |
CommandTimeout | |
CommandType | CommandType.Text |
connection パラメータの値である新しい SqlConnection。 |
SqlCommand を作成し、そのプロパティの一部を設定する例を次に示します。
Public Sub CreateCommand(ByVal queryString As String, _ ByVal connectionString As String) Using connection As New SqlConnection(connectionString) Dim command As New SqlCommand(queryString, connection) connection.Open() Dim reader As SqlDataReader = command.ExecuteReader() While reader.Read() Console.WriteLine(String.Format("{0}, {1}", _ reader(0), reader(1))) End While End Using End Sub
private static void CreateCommand(string queryString, string connectionString) { using (SqlConnection connection = new SqlConnection( connectionString)) { SqlCommand command = new SqlCommand( queryString, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Console.WriteLine(String.Format("{0}, {1}", reader[0], reader[1])); } } }
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
SqlCommand コンストラクタ (String)
アセンブリ: System.Data (system.data.dll 内)
構文
解説
SqlCommand のインスタンスを作成すると、次の読み書き可能プロパティが初期値に設定されます。
CommandText | cmdText |
CommandTimeout | |
CommandType | CommandType.Text |
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
SqlCommand コンストラクタ
オーバーロードの一覧
名前 | 説明 |
---|---|
SqlCommand () | SqlCommand クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
SqlCommand (String) | クエリ テキストを指定して、SqlCommand クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
SqlCommand (String, SqlConnection) | クエリ テキストと SqlConnection を指定して、SqlCommand クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
SqlCommand (String, SqlConnection, SqlTransaction) | クエリ テキスト、SqlConnection、および SqlTransaction を指定して、SqlCommand クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
- SqlCommand コンストラクタ ()のページへのリンク