i have calculated for the first 10 days that is (1-08-2014 to 10-08-2014)
use this method
DataSet sds = new DataSet();
string vew = "select * from salary where Id='" + TextBox1.Text + "' and nextdate='" + TextBox2.Text + "' ";
sds = mvl.GETDS(vew);
GridView1.DataSource = sds;
GridView1.DataBind();
int count = 0;
foreach (GridViewRow row in this.GridView1.Rows)
{
if (row.Cells[15].Text == "Present")
{
count++;
}
}
this.Label3.Text = count.ToString();
Label3.ForeColor = System.Drawing.Color.LightPink;
in this i got the result 10 days as output
now my need is (12-08-2014 to 20-08-2014) i need to calculate the days
if i use like this means
DataSet sds = new DataSet();
string vew = "select * from salary where Id='" + TextBox1.Text + "' and nextdate='" + TextBox2.Text + "' and Status='" + TextBox3.Text + "'";
sds = mvl.GETDS(vew);
GridView1.DataSource = sds;
GridView1.DataBind();
int count = 0;
foreach (GridViewRow row in this.GridView1.Rows)
{
if (row.Cells[15].Text == "Present")
{
count++;
}
}
this.Label3.Text = count.ToString();
Label3.ForeColor = System.Drawing.Color.LightPink;
it show the 1ly one day but i need 8 days as output


Akhil KhareRank #7,443 · 241 reputationPosted Aug 18, 2014, 4:39 AM EDT
According to your question your count is increasing with all "present" data. Can you please share your test data and values of all the parameters once.
Alok SaxenaRank #3,748 · 395 reputationPosted Aug 19, 2014, 11:40 PM EDT
string vew = "select * from salary where Id='" + TextBox1.Text + "' and nextdate='" +
TextBox2.Text + "' and Status='" + TextBox3.Text + "'";
1) What is the purpose of TextBox3.Text , Because query of first method dose not have status criteria.
2)And run the query in Sql Server to find out number of rows return form sql query 12-08-2014 to 20-08-2014
Regards
Alok Saxena