looping between the colums on of every row each cells

May 27 2014 7:23 AM
Dear,
 
I have table in sql server like this
 
 
studentid name marks1 marks2 marks3 marks4 marks5 marks6 marks7 Total Sub Need_Percentage of Marks
1 Sanjeev 78 87 76 78 95     5 ?
2 Sandeep 78 87 76 78 95 59   6 ?
3 Sumit 78     78 95 52   4 ?
4 Sudhir 78 85 0 78 95 52   6 ?
5 Ram AB 85 23 85 12     5 ?
 
i want the percentage of total marks obtained by the students
 
when i am fetching the data using sqldatareader it shows me the dbnull error because it is not getting the value kindly tell the solution any one..
 
how to loop  between the coloums
 
here blank cell means not having value...........
i cannot assign any cell value 0 because it also come in marks it take the null then there is conversion issue so kindly tell me the solution as soon as possible.........
 
Regards
Sanjeev 
 

Answers (2)