Try OpenEdge Now
skip to main content
.NET Open Clients
Passing Parameters : Passing TABLE and TABLE-HANDLE parameters : Temp-table examples : Sample .NET Open Client application using a temp-table
 
Sample .NET Open Client application using a temp-table
The following examples show sample code for calling a procedure with a temp-table.
Calling a procedure with an output dynamic temp-table
// Calling a procedure with an output dynamic temp-table.
Account appObj = new Account("AppServer://myhost/asbroker1", "", "", "");
System.Data.DataTable outDT = null;

// Call the procedure
appObj.GetTTOut(out outDT);

// Run through the ABL DataTable. First output the schema.
int numCols = outDT.Columns.Count;
for (int ix = 0; ix < numCols; ix++)
{
   System.Console.WriteLine(outDT.Columns[ix].ColumnName + " " +
      outDT.Columns[ix].DataType.ToString( ));
}
// Output the data.
foreach (DataRow dr in outDT.Rows)
// Print the first column in the row.
{
   System.Console.WriteLine(" Column 1 " + dr.Columns[0]);
}
Calling a procedure with an input dynamic temp-table
// Calling a procedure with an input dynamic temp-table.
// The ABL DataTable has 2 columns, integer and string.
Account appObj = new Account("AppServer://myhost/asbroker1", "", "", "");
System.Data.DataTable inDT = new System.Data.DataTable( );
inDT.Columns.Add("acctnum", typeof(int));
inDT.Columns.Add("Name", typeof(string));
DataRow testRow;

// Add 3 rows of data.
for (int i = 1; i <= 3; i++)
{
   testRow = inDT.NewRow( );
   testRow[0] = i;
   testRow[1] = "Test String " + i.ToString( );
   inDT.Rows.Add(testRow);
}

// Call the procedure
appObj.SetTTIn(inDT);