2
Answers

sum values in datatable using linq based on conditions

Photo of Vignesh Kumar

Vignesh Kumar

10y
634
1
Hi,
I'm having a datatable like mentioned below.
ID Percentage
1        50
1        30
2        0
2       100
Result:
ID Percentage
1         80
2       100
 
Now I need to sum the percentage for each ID and the percentage for each ID should be 0 or 100 percentage.
If any one of the ID in table doesn't have 0 or 100 I need to alert. Pls suggest me how I can do this in linq and I think its the best way.

Answers (2)

0
Photo of Pradip Pandey
NA 6.9k 1.1m 12y
Hi Saurabh
 You can show your entry records on top on daily basis by using the concept of date, i mean to say that when you are trying to show the records, use order by <datefield> desc clause in your select query.

For question 2 refer this link
http://www.c-sharpcorner.com/UploadFile/satyapriyanayak/how-to-save-image-along-with-details-into-database-in-asp-ne/

Hope this will help you.