日期:2014-05-17 浏览次数:20870 次
DataConn conn = new DataConn(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CheckDay(); } } public void WebMessageBox(string values) { string javaScript = @" <script language = javascript> alert('" + values + "'); </script> "; ClientScript.RegisterStartupScript(this.GetType(), "javaScript", javaScript); //this.Response.Write("<script>alert('"+values+"')</script>"); } public void CheckDay() { SqlDataAdapter da = new SqlDataAdapter("select C_name,C_job,C_birthday from Client where C_type='超级客户' and (select datediff(day,C_birthday,getdate()))<5",conn.GetConnection()); DataTable dt = new DataTable(); da.Fill(dt); if(dt.Rows.Count>0) { string Tishi = ""; for (int i = 0; i < dt.Rows.Count;i++ ) { string xinxi = dt.Rows[i][0].ToString() + dt.Rows[i][1].ToString() + "的生日快要到了哦,日期是" + dt.Rows[i][2].ToString().Replace("0:00:00", "")+"\n"; Tishi=Tishi+xinxi; TextBox1.Text = Tishi; WebMessageBox(xinxi); } } }