UL 拡張:直接の操作用に、コマンド動作を指定してデータベース・テーブルを取り出します。テーブルは、指定されたインデックスを使用して開かれます (ソートされます)。
Visual Basic Public Function ExecuteTable( _ ByVal tableName As String, _ ByVal indexName As String, _ ByVal cmdBehavior As CommandBehavior _ ) As ULTable
C# public ULTable ExecuteTable( string tableName, string indexName, CommandBehavior cmdBehavior );
tableName 開くテーブルの名前。
indexName テーブルを開く (ソートする) インデックスの名前。
cmdBehavior クエリの結果の記述と、接続への影響の記述の System.Data.CommandBehavior フラグのビット単位の組み合わせ。Ultra Light.NET で有効なのは、System.Data.CommandBehavior.Default フラグ、System.Data.CommandBehavior.CloseConnection フラグ、System.Data.CommandBehavior.SchemaOnly フラグだけです。
ULTable オブジェクトとして返されるテーブル。
このメソッドは、ULCommand インスタンスを必要としない ULCommand.ExecuteTable(System.Data.CommandBehavior) のショートカットです。また、以前のバージョンの Ultra Light.NET から移行できるようにするために用意されています (iAnywhere.UltraLite.Connection.GetTable() と iAnywhere.UltraLite.Table.Open() が置き換えられます)。
次のコードでは、MyIndex というインデックスを使用して MyTable というテーブルが開かれます。また、conn という開いた ULConnection インスタンスが想定されています。
' Visual Basic Dim t As ULTable = conn.ExecuteTable( _ "MyTable", "MyIndex", CommandBehavior.Default _ ) ' The line above is equivalent to ' Dim cmd As ULCommand = conn.CreateCommand() ' cmd.CommandText = "MyTable" ' cmd.IndexName = "MyIndex" ' cmd.CommandType = CommandType.TableDirect ' Dim t As ULTable = cmd.ExecuteTable(CommandBehavior.Default) ' cmd.Dispose() |
// C# ULTable t = conn.ExecuteTable( "MyTable", "MyIndex", CommandBehavior.Default ); // The line above is equivalent to // ULTable t; // using(ULCommand cmd = conn.CreateCommand()) // { // cmd.CommandText = "MyTable"; // cmd.IndexName = "MyIndex"; // cmd.CommandType = CommandType.TableDirect; // t = cmd.ExecuteTable(CommandBehavior.Default); // } |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |