Carregando o calendário com registro do banco de dados usando procedure
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
SqlCommand cmd = new SqlCommand("SP_LISTA_FERIADO_PARAM_SEQ_DCE", conexao());
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Seq", SqlDbType.Int).Value = Convert.ToInt16(Request.QueryString["Id"]);
cmd.Connection.Open();
SqlDataReader dr = cmd.ExecuteReader();
DateTime nextdate;
while (dr.Read())
{
nextdate = Convert.ToDateTime(dr["DTAFERIADO"].ToString());
if (nextdate == e.Day.Date)
{
e.Cell.BorderColor = System.Drawing.Color.FromName("#CE000C");
e.Cell.BorderStyle = BorderStyle.Solid;
e.Cell.BorderWidth = 1;
}
}
cmd.Connection.Close();
dr.Close();
}
{
SqlCommand cmd = new SqlCommand("SP_LISTA_FERIADO_PARAM_SEQ_DCE", conexao());
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Seq", SqlDbType.Int).Value = Convert.ToInt16(Request.QueryString["Id"]);
cmd.Connection.Open();
SqlDataReader dr = cmd.ExecuteReader();
DateTime nextdate;
while (dr.Read())
{
nextdate = Convert.ToDateTime(dr["DTAFERIADO"].ToString());
if (nextdate == e.Day.Date)
{
e.Cell.BorderColor = System.Drawing.Color.FromName("#CE000C");
e.Cell.BorderStyle = BorderStyle.Solid;
e.Cell.BorderWidth = 1;
}
}
cmd.Connection.Close();
dr.Close();
}
Comentários
Postar um comentário
Os códigos postados aqui são uma seqüência de instruções de forma ordenada, não compilada para o código de máquina, em uma determinada linguagem de programação.
Ajude a melhorar esses códigos.