Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void Page_Load(object sender, EventArgs e)
    {
 string current_date = DateTime.Now.ToString("dd-MMM-yy");
        Lbl_todays_date.Text = current_date;

        string total_booked = "select count(selected_date) from user_record where selected_date='" + Lbl_todays_date.Text + "'";
        cmd2 = new OleDbCommand(total_booked, cn);
        dr2 = cmd2.ExecuteReader();
        cn.Close();
}
Posted
Updated 24-Feb-14 18:38pm
v2
Comments
Rajkumar_007 25-Feb-14 0:41am    
how to get count of selected record into the variable???

1 solution

Use
protected void Page_Load(object sender, EventArgs e)
    {
 string current_date = DateTime.Now.ToString("dd-MMM-yy");
        Lbl_todays_date.Text = current_date;
 
        string total_booked = "select count(selected_date) from user_record where selected_date='" + Lbl_todays_date.Text + "'";
        cmd2 = new OleDbCommand(total_booked, cn);
       dr2 = Convert.ToInt32(cmd2.ExecuteScaler()); //instead of cmd2.ExecuteReader();
      //ExecuteScalar method will return you the integer value
        
        cn.Close();
}
 
Share this answer
 
Comments
Rajkumar_007 25-Feb-14 2:07am    
Thank you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900