Kbase P130688: How to add rows to a strongly typed DataTable in .NET?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/21/2008 |
|
Status: Unverified
GOAL:
How to add rows to a strongly typed DataTable in .NET?
GOAL:
How to add rows to a strongly typed DataTable in .NET using the actual field names?
FACT(s) (Environment):
OpenEdge 10.x
Windows
FIX:
When a strongly typed DataTable is generated by ProxyGen from a Temp-Table definition a method is automatically generated which returns a DataRow instance representing a new record.
The method is named New<YourTempTableName>Row.
If you assume (as an example) a Temp-Table name of ttCustomer then the method in the generated proxy will be called NewttCustomerRow.
The following code fragment shows how to use this method to create a new row, add data to the newly created row and then add the newly created row to the DataTable:
StrongTypesNS.ttCustomerDataTable vTempTable = new StrongTypesNS.MyttCustomerDataTable();
StrongTypesNS.ttCustomerRow vNewRow = vTempTable.NewttCustomerRow();
vNewRow.BeginEdit();
vNewRow.CustNum = 1000;
vNewRow.Name = "Test Customer";
vNewRow.EndEdit();
vTempTable.AddttCustomerRow(vNewRow);