Before I begin, I apologize if this is something stupid on my part, or it's a question that's already been answered.
Basically, I need to calculate the percentage of 1 data set to another. So I have this:
When I run it, my messagebox output:
shows that the percentage is only assigned curr_count. So, in the first example, I have:
curr_count = 159
total = 297
percentage = 159
although percentage should equal 53. Any ideas?
Basically, I need to calculate the percentage of 1 data set to another. So I have this:
Code:
int percentage = 0;
DataRow r = dsLocal.Tables[0].Rows[0];
int curr_count = System.Convert.ToInt32(r[0]);
if (curr_count > 0)
{percentage = (curr_count % total);}
else
{percentage = 0; }
When I run it, my messagebox output:
Code:
MessageBox.Show(percentage.ToString(+" "+curr_count.ToString()+ "/"+total.ToString());
shows that the percentage is only assigned curr_count. So, in the first example, I have:
curr_count = 159
total = 297
percentage = 159
although percentage should equal 53. Any ideas?