Bu kodları
Fatih Demirci'nin bir geliştirmesinden aldım.
Dataset gönderme:
System.Data.DataTable dataTable;
System.Data.DataColumnCollection dataTableColumns;
System.Data.DataRowCollection DataRowCollection;
System.Data.DataRow tmpRow;
System.Data.DataSet dataset = new System.Data.DataSet();
System.Data.DataTableCollection dataTableCollection;
dataTable = new System.Data.DataTable();
dataTableColumns = dataTable.get_Columns();
//satırları tanımla
dataTableColumns.Add("ACCOUNTNO", System.Type::GetType("System.String"));
dataTableColumns.Add("ITEMNO", System.Type::GetType("System.String"));
dataTableColumns.Add("TOACCOUNTNUM", System.Type::GetType("System.String"));
dataTableColumns.Add("RETURNREASONIDD", System.Type::GetType("System.String"));
dataTableColumns.Add("QUANTITY", System.Type::GetType("System.Double"));
dataTableColumns.Add("DESCRIPTION", System.Type::GetType("System.String"));
//bir satır al
DataRowCollection = dataTable.get_Rows();
tmpRow = dataTable.NewRow();
//satırı doldur
tmpRow.set_Item("ACCOUNTNO","MU_014600");
tmpRow.set_Item("ITEMNO","200.05.01.0306");
tmpRow.set_Item("TOACCOUNTNUM","MU_014600");
tmpRow.set_Item("RETURNREASONIDD","");
tmpRow.set_Item("QUANTITY",11);
tmpRow.set_Item("DESCRIPTION","");
DataRowCollection.Add(tmpRow);
dataTable.AcceptChanges();
//bu aşamada eğer karşı taraf data table istiyorsa, data table hazır
//eğer dataset istiyorsa bu data tableyi bir datasete ekle
dataTableCollection = dataSet.get_Tables();
dataTableCollection.Add(datatable);
//artık dataset de hazır
Dataset alma:
System.Data.DataTable dataTable;
System.Data.DataTableCollection dataTableCollection;
System.Data.DataColumnCollection dataColumnCollection;
System.Data.DataRowCollection dataRowCollection;
System.Data.DataRow dataRow;
System.Data.DataColumn dataColumn;
System.Data.DataTable returnData;
;
dataTableCollection = dataSet.get_Tables();
totalTable = dataTableCollection.get_Count();
for(i = 0; i < totalTable; i ++)
{
dataTable = dataTableCollection.get_Item(i);
dataColumnCollection = dataTable.get_Columns();
DataRowCollection = dataTable.get_Rows();
totalRow = dataRowCollection.get_Count();
totalCol = dataColumnCollection.get_Count();
for( j = 0; j < totalRow; j ++)
{
dataRow = dataRowCollection.get_Item(j);
custAccount = dataRow.get_Item("ACCOUNTNO");
itemId = dataRow.get_Item("ITEMNO");
toCustAccount = dataRow.get_Item("TOACCOUNTNUM");
strtext = dataRow.get_Item("RETURNREASONIDD");
krc_DefectiveId = str2int64(strtext);
strtext = dataRow.get_Item("QUANTITY");
_b2bdesc = dataRow.get_Item("DESCRIPTION");
...
Hiç yorum yok:
Yorum Gönder