Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Am trying to convert
C#
BasicAmount = double.Parse(ItemDetails.Compute("SUM(CONVERT(basicamount, 'System.Decimal'))", string.Empty).ToString());
but this gives error like "Expecting a single column argument with possible 'Child' qualifier.".
Tell me how to convert string column to Double
Posted
Comments
Abhipal Singh 3-Jul-15 7:23am    
what is the output of ItemDetails.Compute("SUM(CONVERT(basicamount, 'System.Decimal'))", string.Empty).ToString()?

Also, can you please elaborate what you are trying to do?
Ni!E$H_WAGH 3-Jul-15 7:32am    
trying to convert basicamount col for sum up from ItemDetails datatable which is stoared a string

1 solution

Try this
var result = ItemDetails.AsEnumerable().Sum(x => Convert.ToDecimal(x["basicamount"]));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900