另一个简单的问题..... [英] another simple question.....

查看:68
本文介绍了另一个简单的问题.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
   {
       myda = new SqlDataAdapter("Select EventName from Events where (EventDate='" + Calendar1.SelectedDate.ToString("s") + "'and UserId ='" + Session["Id"].ToString() + "')", mycn);
       dt = new DataTable();
       myda.Fill(dt);
       if (dt.Rows.Count == 0)
       {
           DataGrid1.Visible = false;
       }
       else
       {
           DataGrid1.Visible = true;
           DataGrid1.DataSource = dt;
           DataGrid1.DataBind();
       }
   }


myda =新的SqlDataAdapter(& quot;从事件中选择EventName其中(EventDate ='" + Calendar1.SelectedDate.ToString(& quot; s& quot;)
我只想简单地知道这是做什么的?


myda = new SqlDataAdapter("Select EventName from Events where (EventDate='" + Calendar1.SelectedDate.ToString("s")
i want to simply know about what is this s an what it do?

推荐答案

Date.ToString("s")以2000-08-17T16:32:32
http://msdn.microsoft.com/en-us/library/aa326721 (v = vs.71).aspx [ http://msdn.microsoft.com/en-us/library/az4se3k1.aspx [ ^ ]
Date.ToString("s") gets the date in format 2000-08-17T16:32:32

http://msdn.microsoft.com/en-us/library/aa326721(v=vs.71).aspx[^]
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^]


这将创建一个数据适配器,该数据适配器将用于查询事件表中事件日期与用户选择的日期匹配的事件表.数据适配器用于填充绑定到网格的DataTable .
This creates a data adapter that will be used to query the events table where the event date matches the date selected by the user. The data adapter is used to fill the DataTable that is bound to the grid.


这篇关于另一个简单的问题.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆