public partial class Default2 : System.Web.UI.Page
{
string M_Str_mindate;
string M_Str_maxdate;
protected void Page_Load(object sender, EventArgs e)
{
//显示统计时间
labCountDate.Text = DateTime.Now.ToString();
//本日访问人数的计算
M_Str_mindate = DateTime.Now.ToShortDateString() + " 0:00:00";
M_Str_maxdate = DateTime.Now.AddDays(1).ToShortDateString() + " 0:00:00";
DataSet ds = DB.reDs("select * from tb_CounterInfo where LoginTime>='" + M_Str_mindate + "'and LoginTime<'" + M_Str_maxdate + "'");
labCountDay.Text = ds.Tables[0].Rows.Count.ToString();
}
}

数据库的Logintime是datetime类型的