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 ProDataSet parameter : Adding the ProDataSetMetaData object with its DataSet as a ProDataSet parameter
 
Adding the ProDataSetMetaData object with its DataSet as a ProDataSet parameter
Add the ProDataSetMetaData object together with the ADO.NET DataSet it describes by passing them as parameters of the AddDataset( ) or AddDatasetHandle( ) method that you use to add the ProDataSet parameter to the ParamArray object. For more information, see DATASETand DATASET-HANDLE.
The following example adds a temp-table parameter defined with no indexes.
Sample OpenAPI fragment setting a ProDataSet parameter
// Create the ParamArray
ParamArray parms = new ParamArray(1);

//Create DataSet
DataSet proDataSet = new DataSet( );
...

// Create the ProDataSetMetaData
ProDataSetMetaData dsMetaData = new ProDataSetMetaData
             ("dsCustOrd", "ProDataSetTest.StrongTypesNS.dsCustOrdDataSet");

// Create the TempTableMetaData for the Customer table
TempTableMetaData ttCustMD = new TempTableMetaData
                         ("ttCust", "ttCustDataTable", 3, false, , 0,
                          null, null, null);

ttCustMD.SetFieldMetaData(1, "CustNum", 0, Parameter.PRO_INTEGER, 0, 0);
ttCustMD.SetFieldMetaData(2, "Name", 0, Parameter.PRO_CHARACTER 1, 0);
ttCustMD.SetFieldMetaData(3, "SalesRep", 0, Parameter.PRO_CHARACTER 2, 0);

// Create the TempTableMetaData for the Order table
TempTableMetaData ttOrderMD = new TempTableMetaData
                          ("OrderDetails",
                           "OrderProxy.StrongTypesNS.OrderDetailsDataTable",
                           6, false, , 0, null, null, null);

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

// Add the tables to the DataSet meta data
dsMetaData.AddDataTable(ttCustMD);
dsMetaData.AddDataTable(ttOrderMD);

// Create and add the relations to the DataSet meta data
ProDataRelationMetaData relation = new ProDataRelationMetaData
                              ("custNum", 1, 0, 1, "CustNum,CustNum", null);
dsMetaData.AddDataRelation(relation);

parms.AddDataset(0, proDataSet, ParamArrayMode.OUTPUT, dsMetaData);