C
Coleen
Hi All
I found the way to get my column sum (Thanks Cor I did it a little different, but the result is what I wanted) I used:
dt_stat_report_3b.Columns.Add(New DataColumn("Sum", GetType(Double), "sum(Column_10_ld_act_125_gtr_fy_fy_hh_avg)"))
where dt_stat_report_3b is my datatable, Sum is my column name and sum(Column_10_ld_act_125_gtr_fy_fy_hh_avg) is the sum of the column I needed. This Does return me the correct value in the column I've specified, but now I need that value to be stored in a variable that I can use in another calculation. I've tried:
ld_act_125_gtr_fy_hh_avg_grnd_tot = CDbl(dt_stat_report_3b.Columns.Item(15).ToString)
Where ld_act_125_gtr_fy_hh_avg_grnd_tot is the variable and is declared as a Double. This returns an error that the input string was not in the correct format. What I really want to do is get the value from that column and populate the variable with it. I CAN'T get the CDbl() to work! I've tried to do it as CDbl(), I tried System.Convert.ToDouble() but I ALWAYS get an error that the input string was in an incorrect format. I just want the VALUE from the Column that I've summed! Please, can someone explain how to get the string to convert to a double or how to get dt_stat_report_3b.Columns.Item(15).Value? Value is not an option and I don't know what else to try!
Any help is GREATLY Appreciated, since I have spent all day on this problem!
Thanks!
Coleen
I found the way to get my column sum (Thanks Cor I did it a little different, but the result is what I wanted) I used:
dt_stat_report_3b.Columns.Add(New DataColumn("Sum", GetType(Double), "sum(Column_10_ld_act_125_gtr_fy_fy_hh_avg)"))
where dt_stat_report_3b is my datatable, Sum is my column name and sum(Column_10_ld_act_125_gtr_fy_fy_hh_avg) is the sum of the column I needed. This Does return me the correct value in the column I've specified, but now I need that value to be stored in a variable that I can use in another calculation. I've tried:
ld_act_125_gtr_fy_hh_avg_grnd_tot = CDbl(dt_stat_report_3b.Columns.Item(15).ToString)
Where ld_act_125_gtr_fy_hh_avg_grnd_tot is the variable and is declared as a Double. This returns an error that the input string was not in the correct format. What I really want to do is get the value from that column and populate the variable with it. I CAN'T get the CDbl() to work! I've tried to do it as CDbl(), I tried System.Convert.ToDouble() but I ALWAYS get an error that the input string was in an incorrect format. I just want the VALUE from the Column that I've summed! Please, can someone explain how to get the string to convert to a double or how to get dt_stat_report_3b.Columns.Item(15).Value? Value is not an option and I don't know what else to try!
Any help is GREATLY Appreciated, since I have spent all day on this problem!
Thanks!
Coleen