Try OpenEdge Now
skip to main content
.NET Open Clients
Using the Open Client .NET OpenAPI to Directly Access the AppServer : Setting up parameters and return types : Defining the schema for a temp-table parameter : Adding the TempTableMetaData with its DataTable as a temp-table parameter
 
Adding the TempTableMetaData with its DataTable as a temp-table parameter
Add the TempTableMetaData object together with ADO.NET DataTable it describes by passing them as parameters of the AddTable( ) or AddTableHandle( ) method that you use to add the temp-table parameter to the ParamArray object. For more information, see TABLE and TABLE-HANDLE.
The following example adds a temp-table parameter defined with no indexes.
Sample OpenAPI fragment adding a temp-table parameter
// Create the ParamArray
ParamArray parms = new ParamArray(1);

//Create Data table
DataTable table = new DataTable( );
...

// Set up meta data
TempTableMetaData metaData1 = new TempTableMetaData
                          ("OrderDetails",
                           "OrderProxy.StrongTypesNS.OrderDetailsDataTable",
                           6, false, 0, null, null,null);

metaData1.SetFieldMetaData
             (1, "OrderNum",     0, Parameter.PRO_INTEGER, 0, 0);
metaData1.SetFieldMetaData
             (2, "SalesRep",     0, Parameter.PRO_CHARACTER 1, 0);
metaData1.SetFieldMetaData
             (3, "OrderDate",    0, Parameter.PRO_DATE      2, 0);
metaData1.SetFieldMetaData
             (4, "ShipDate",     0, Parameter.PRO_DATE      3, 0);
metaData1.SetFieldMetaData
             (5, "TotalDollars", 0, Parameter.PRO_DECIMAL   4, 0);
metaData1.SetFieldMetaData
             (6, "OrderStatus",  0, Parameter.PRO_CHARACTER 5, 0);

parms.AddTable(0, table, ParamArrayMode.INPUT, metaData1);