ヘッダーをスキップ
Oracle® Objects for OLE開発者ガイド
11gリリース2 (11.2) for Microsoft Windows
B58887-04
  目次へ移動
目次
索引へ移動
索引

前
 
次
 

Count(OraObject/Ref)プロパティ

説明

コレクション内のOraAttributeオブジェクトの数を戻します。これは、OraRefの基礎となる参照可能オブジェクトまたはOraObjectの基礎となる値インスタンスの属性の総数と同じです。実行時は読取り専用です。

使用方法

attrcount = OraRef.Count  
attrcount = OraObject.Count 

データ型

Integer

備考

添字または属性名を使用すると、個々の属性にアクセスできます。OraObjectまたはOraRef属性の索引は1から開始します。

次の例では、Countプロパティの使用方法を示します。サンプル・コードを実行する前に、必要なデータ型と表がデータベース内にあることを確認してください。「OraObjectおよびOraRefの例で使用されているスキーマ・オブジェクト」を参照してください。

 
Dim OraSession as OraSession 
Dim OraDatabase as OraDatabase 
Dim OraDynaset as OraDynaset 
Dim Address as OraObject 
 
'Create the OraSession Object. 
Set OraSession = CreateObject("OracleInProcServer.XOraSession") 
 
'Create the OraDatabase Object by opening a connection to Oracle. 
Set OraDatabase = OraSession.OpenDatabase("ExampleDb", "scott/tiger", 0&) 
 
'create a dynaset object from person_tab 
set OraDynaset = OraDatabase.CreateDynaset("select * from  person_tab",0&) 
 
'retrieve a address column from person_tab. 
'Here Value property of OraField object returns Address OraObject
set Address = OraDynaset.Fields("Addr").Value 
 
'access the attribute by dot notation 
msgbox Address.Street 
 
'access the attribute using '!' notation ( early binding application) 
msgbox Address!Street 
 
'access the attribute by index 
msgbox Address(1) 
 
'access the attribute by name 
msgbox Address("Street") 
 
'access all the attributes of Address OraObject in the dynaset 
Do Until OraDynaset.EOF 
    For index = 1 To Address.Count 
        msgbox Address(index) 
    Next Index 
  OraDynaset.MoveNext 
 
Loop