创建DataTable

System.Data.DataSet ds = new System.Data.DataSet();
System.Data.DataTableCollection dtCollection = ds.get_Tables();
System.Data.DataTable table1 = new System.Data.DataTable("Table1");
System.Data.DataRowCollection dataRowCollection = table1.get_Rows();
System.Data.DataColumnCollection dataColCollection = table1.get_Columns();
System.Data.DataRow row;

dtCollection.Add(table1);
dataColCollection.Add("ID", System.Type::GetType("System.Int32"));
dataColCollection.Add("ItemId", System.Type::GetType("System.String"));
dataColCollection.Add("ItemName", System.Type::GetType("System.String"));
dataColCollection.Add("WmsLocationId", System.Type::GetType("System.String"));
dataColCollection.Add("BatchSerial", System.Type::GetType("System.String"));
dataColCollection.Add("Qty", System.Type::GetType("System.Double"));
dataColCollection.Add("InventQty", System.Type::GetType("System.Double"));
dataColCollection.Add("UnitId", System.Type::GetType("System.String"));
dataColCollection.Add("Mark", System.Type::GetType("System.String"));

while select journalTrans
where journalTrans.JournalID == journalTable.JournalID
{
  invDim = InventDim::find(journalTrans.InventDimId);
  batchSerial = strfmt("%1%2",invDim.inventBatchId,invDim.inventSerialId);
  inventQty = WL_availQty(journalTrans.ItemId,invDim.InventLocationId,invDim.wMSLocationId,invDim.inventBatchId,invDim.inventSerialId);

  i++;
  row = table1.NewRow();
  row.set_Item("ID",i);
  row.set_Item("ItemId",journalTrans.ItemId);
  row.set_Item("ItemName",journalTrans.itemName());
  row.set_Item("WmsLocationId",invDim.wMSLocationId);
  row.set_Item("BatchSerial",batchSerial);
  row.set_Item("Qty",journalTrans.Qty);
  row.set_Item("InventQty",inventQty);
  row.set_Item("UnitId",journalTrans.unitId());
  dataRowCollection.Add(row);
}

 

创建DataTable

上一篇:scrapy框架集成http


下一篇:微信小程序class封装http