Consultor Eletrônico



Kbase P117815: How do I pass a ProDataSet as an INPUT-OUTPUT parameters in .NET using the OpenAPI?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/09/2008
Status: Verified

GOAL:

How do I pass a ProDataSet as an INPUT-OUTPUT parameters in .NET using the OpenAPI?

FACT(s) (Environment):

OpenEdge 10.1x
Windows

FIX:

The following sample code shows how to pass a ProDataSet as an INPUT-OUTPUT parameter to the AppServer from .NET client using the OpenAPI.

Imports Progress.Open4GL.Proxy
Imports Progress.Open4GL
Imports Progress.Open4GL.Exceptions

Module ModMain
Sub Main()
Dim vParameterList As New Progress.Open4GL.Proxy.ParamArray(1)
Dim vConnection As New Connection("AppServer://localhost:5162/asbroker1", "", "", "")

Dim vAppServer As New OpenAppObject(vConnection, "")
Dim vRowCollection As DataRowCollection
Dim vRow As DataRow

Dim vTable As New DataTable("tttest")

Dim vTempTableSchema As TempTableMetaData = New TempTableMetaData("tttest", Nothing, 2, False, 0, Nothing, Nothing, Nothing)

Dim vProDataSetSchema As ProDataSetMetaData = New ProDataSetMetaData("dstest", Nothing)
Dim vProDataSet As New DataSet

vTable.Columns.Add("blob1", System.Type.GetType("System.Int32"), Nothing)
vTable.Columns.Add("clob1", System.Type.GetType("System.String"), Nothing)

vTempTableSchema.SetFieldMetaData(1, "blob1", 0, Parameter.PRO_INTEGER, 0, 0)
vTempTableSchema.SetFieldMetaData(2, "clob1", 0, Parameter.PRO_CHARACTER, 1, 0)
vProDataSetSchema.AddDataTable(vTempTableSchema)

vProDataSet.Tables.Add(vTable)

vParameterList.AddDataset(0, vProDataSet, ParamArrayMode.INPUT_OUTPUT, vProDataSetSchema)

vAppServer.RunProc("lobexample.p", vParameterList)

vProDataSet = vParameterList.GetOutputParameter(1)

vRowCollection = vProDataSet.Tables(0).Rows()

For Each vRow In vRowCollection
Debug.WriteLine(vRow.ItemArray(0) & " " & vRow.ItemArray(1))
Next
End Sub
End Module