ASP.NET 在日期控件上选择日期在gridview控件上选择出对应的日期列
在Label控件上显示条数为什么有1条的时候显示0有一条的时候显示1就慢了一拍代码如下就大神改改protectedvoidPage_Load(objectsender,E...
在Label控件上显示条数为什么有1条的时候显示0 有一条的时候显示1 就慢了一拍
代码如下就大神改改
protected void Page_Load(object sender, EventArgs e)
{
//SqlConnection con = new SqlConnection(@"Data Source=long-pc\sqlexpress;Initial Catalog=sqxt;Integrated Security=True");
//con.Open();
////建立命令
//SqlCommand cmd = new SqlCommand("select count (*) from sq", con);
////SqlDataReader 显示数据
//SqlDataReader dr = cmd.ExecuteReader();
//if (dr.Read())
//{
//Label1.Text = (this.GridView1.Rows.Count).ToString();
//dr[""].ToString();
//}
}
protected void Button_Click(object sender, EventArgs e)
{
this.Calendar.Visible = true;
}
protected void Calendar_SelectionChanged(object sender, EventArgs e)
{
this.TextBox.Text = this.Calendar.SelectedDate.ToString("yyyy/MM/dd");
Label1.Text = (this.GridView1.Rows.Count).ToString();
this.Calendar.Visible = false;
// this.Label1.Text = (this.GridView1.Rows.Count).ToString();
//SqlConnection con = new SqlConnection(@"Data Source=long-pc\sqlexpress;Initial Catalog=sqxt;Integrated Security=True");
//con.Open();
////建立命令
//SqlCommand cmd = new SqlCommand("select time from sq", con);
////SqlDataReader 显示数据
//SqlDataReader dr = cmd.ExecuteReader();
//if (dr.Read() == this.Calendar.SelectedDate)
//{
// Label1.Text = dr[""].ToString();
//} 展开
代码如下就大神改改
protected void Page_Load(object sender, EventArgs e)
{
//SqlConnection con = new SqlConnection(@"Data Source=long-pc\sqlexpress;Initial Catalog=sqxt;Integrated Security=True");
//con.Open();
////建立命令
//SqlCommand cmd = new SqlCommand("select count (*) from sq", con);
////SqlDataReader 显示数据
//SqlDataReader dr = cmd.ExecuteReader();
//if (dr.Read())
//{
//Label1.Text = (this.GridView1.Rows.Count).ToString();
//dr[""].ToString();
//}
}
protected void Button_Click(object sender, EventArgs e)
{
this.Calendar.Visible = true;
}
protected void Calendar_SelectionChanged(object sender, EventArgs e)
{
this.TextBox.Text = this.Calendar.SelectedDate.ToString("yyyy/MM/dd");
Label1.Text = (this.GridView1.Rows.Count).ToString();
this.Calendar.Visible = false;
// this.Label1.Text = (this.GridView1.Rows.Count).ToString();
//SqlConnection con = new SqlConnection(@"Data Source=long-pc\sqlexpress;Initial Catalog=sqxt;Integrated Security=True");
//con.Open();
////建立命令
//SqlCommand cmd = new SqlCommand("select time from sq", con);
////SqlDataReader 显示数据
//SqlDataReader dr = cmd.ExecuteReader();
//if (dr.Read() == this.Calendar.SelectedDate)
//{
// Label1.Text = dr[""].ToString();
//} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询