Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
「UL 拡張:」SQL SELECT 文を実行し、ULResultSet オブジェクトとして結果セットを返します。
Public Function ExecuteResultSet() As ULResultSet
public ULResultSet ExecuteResultSet()
ULResultSet オブジェクトとして返される結果セット。
ULException クラス SQL エラーが発生しました。
InvalidOperationException コマンドのステータスは有効ではありません。ULCommand.Connection 値が見つからないか閉じている、ULCommand.Transaction 値が接続の現在のトランザクションのステータスに一致しない、または ULCommand.CommandText 値が無効です。
この文は、必要に応じて ULCommand.CommandText 値と ULCommand.Parameters 値が指定された、現在の ULCommand オブジェクトです。ULResultSet オブジェクトは、位置付け更新や削除の実行対象となる編集可能な結果を表します。編集可能な結果セットには、ULCommand.ExecuteTable メソッドまたは ULDataAdapter オブジェクトを使用します。
ULCommand.CommandType 値が System.Data.CommandType.TableDirect の場合は、ExecuteReader メソッドが ULCommand.ExecuteTable 呼び出しを時実行して、ULTable オブジェクト ダウンキャストを ULResultSet オブジェクトとして返します。
このメソッドは、動的 SQL による位置付け更新と削除をサポートします。
cmd.CommandText = "SELECT id, season, price FROM OurProducts"; ULResultSet rs = cmd.ExecuteResultSet(); while( rs.Read() ) { string season = rs.GetString( 1 ); double price = rs.GetDouble( 2 ); if( season.Equals( "summer" ) ) { rs.UpdateBegin(); rs.SetDouble( 2, price * .5 ); rs.Update(); } if( season.Equals( "discontinued" ) ) { rs.Delete(); } } rs.Close();