public DsInventory.STOCKMASTERDataTable GetStockTableWithItemCodes(DsInventory.SALESINVDETAILDataTable salesinvdetail) { var dsItemCodes = new DsInventory().STOCKMASTER; var ta = new DsInventoryTableAdapters.STOCKMASTERTableAdapter { Connection = { ConnectionString = _constr } }; string itemcodes = string.Empty; foreach (DsInventory.SALESINVDETAILRow drts in salesinvdetail.Rows) { if (drts.ISRETURN) { itemcodes += drts.ITEMNO + ","; } } ta.FillByItemcodes(dsItemCodes, itemcodes); return dsItemCodes; }