回复 2# 仰望星空 的帖子
那楼主! 帮我看看这个代码!
string UserName = Session["UserName"].ToString();
int i=1;
SqlConnection con=new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
con.Open();
string Da = DateTime.Now.ToLongDateString();
string sql = "select * from [Check] where UserName='"+UserName+ "' and shang="+i+" order by OndutyId desc";
SqlCommand com = new SqlCommand(sql,con);
SqlDataReader dr = com.ExecuteReader();
if (dr.Read())
{
string Check = dr["Checkdate"].ToString();
if (Check == Da)
{
Response.Write("<script>alert('你已完成上班考勤!')</script>");
this.MySpan1.Visible = false;
}
else
{
this.MySpan1.Visible = false;
this.MySpan.Visible = true;
}
}
else
{
this.MySpan1.Visible = false;
this.MySpan.Visible = true;
}
con.Close();
这个里面的获取时间就是服务器的时间被? 也就是客户端看到的网页不参与这些代码的运行?