public static DataTable ds(string day) { string a; SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["pubconn"].ConnectionString); con.Open(); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = new SqlCommand(" select [title_id],[pubdate],[title] from [titles] where [pubdate]="+day,con); a = sda.SelectCommand.CommandText.ToString(); DataSet ds = new DataSet(); sda.Fill(ds,"titles"); con.Close(); return ds.Tables["titles"];
} protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { CalendarDay d = e.Day; TableCell c = e.Cell; int a; if (d.IsOtherMonth) { c.Controls.Clear(); } else { try { string txt = arrr[d.Date.Month][d.Date.Day]; if (txt != null) { string day = e.Day.Date.ToShortDateString(); a = ds(day).Rows.Count; foreach (DataRow dr in ds(day).Rows) { c.Controls.Clear(); c.Controls.Add(new LiteralControl(" <a href='http://mgod.cnblogs.com/haha.aspx?dt="+day+"'> <b>"+e.Day.Date.Day+" </b> </a>")); }