このメソッドはストアドプロシージャを呼び出して、場合によっては結果セットを作成します。
このメソッドでは、ストアドプロシージャに対して入力パラメータのみがサポートされます。ストアドプロシージャからデータを返すには、出力パラメータを使用するのではなく、結果セットに返すようにします。
DB2® の場合、このメソッドでは PROCEDURE プロパティに定義されたストアドプロシージャが実行されます。プロシージャで結果セットが作成される場合は、RECORD_LIMIT プロパティに定義されているレコード数に結果セットを制限します。
LCConnection
count = lcConnection.Call(parmFieldList, recordIndex, destFieldList)
パラメータ |
説明 |
---|---|
parmFieldList |
LCFieldlist。ストアドプロシージャ用の入力パラメータリスト。このプロパティには「Nothing」は指定できません。プロシージャに引数がない場合は、空のフィールドリストを指定します。 |
recordIndex |
Long、1 以上。フィールドリスト内でのパラメータ値の位置を表す索引。 |
destFieldList |
LCFieldlist。結果セットのメタデータを格納するフィールドリスト。結果セット内のフィールドがこのフィールドリストに追加されます。結果セットのメタデータが必要ない場合は「Nothing」を使用します。 |
値 |
説明 |
---|---|
count |
Long。呼び出しの影響を受けたレコード数。データソースによってはカウント数が返されない場合もあります。カウント数が明らかでない場合には LCCOUNT_UNKNOWN が返されます。 |
Option Public
Uselsx "*lsxlc"
Sub Initialize
Dim Con As New LCConnection ("sybase")
Dim Parms As New LCFieldList
Dim Result As New LCFieldList
Dim Parm As LCField
' set properties to connect to both data sources
Con.Server = "Rainbow"
Con.Userid = "JDoe"
Con.Password = "xyzzy"
' set the connection property to the stored procedure name
Con.Procedure = "NPInsertIntoSM_ADBOOK"
' now connect
Con.Connect
' append the new field to the fieldlist
Set Parm = Parms.Append ("spParm", LCTYPE_TEXT)
' set the field to a value -- in this case it is
' the one parameter needed for the stored procedure
Parm.text = " 'Edge' "
' using the fieldlist containing the field with the
' stored procedure parameter, call the stored procedure
count = Con.Call (Parms, 1, Result)
If count = 0 Then
Print "No results were generated from the procedure call."
Elseif count = LCCOUNT_UNKNOWN Then
Print "A result set was generated but the number of results is unknown."
Else
Print "The stored procedure returned " & count & " records."
End If
End Sub
A result set was generated but the number of results is unknown.