首页 > 代码库 > net1:DateTime,Application与Session,
net1:DateTime,Application与Session,
原文发布时间为:2008-07-29 —— 来源于本人的百度文章 [由搬家工具导入]
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
string ch = "hao";
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(ch);
DateTime dt;
dt = DateTime.Now;
DateTime dat = Convert.ToDateTime("2006.3.12");
Response.Write(dat.Year.GetType() + "<br>");
Response.Write(dat.ToLongDateString() + "<br>");
Response.Write("nian:" + dt.Year + "<br>" + "yue:" + dt.Month +"<br>"+ "ri:" + dt.Day);
Label1.Text = "shij"+dat;
Response.Write(dt.ToLongDateString()+"<br>"+dt.ToLongTimeString()+"<br>"+dt.ToShortDateString());
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = ch;
Response.Write("<br>" + ch);
}
}
-----------------------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default6 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Application.Lock();
Application["a"] = (int)Application["a"] + 1;
Application.UnLock();
Response.Write(Application["a"]);
Response.Write(Session["name"]);
}
}
net1:DateTime,Application与Session,