المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : get Datetime array through DataReader



C# Programming
11-08-2009, 08:31 AM
hello all

i want to know how to get DateTime array through DataReader and set it as bolded Dates on MonthCalender

i have the following code ..

SqlCommand GetDates = new SqlCommand();
GetDates.Connection = new SqlConnection(ConS);
GetDates.CommandType = CommandType.Text;
GetDates.CommandText = "select Reserve_Date from reservations where Done = 0";

GetDates.Connection.Open();
SqlDataReader rd = GetDates.ExecuteReader();

while (rd.Read())
{

DateTime ReservDays = (DateTime)rd["Reserve_Date"];
monthCalendar1.AnnuallyBoldedDates = new DateTime[] { ReservDays };
}
rd.Close();
GetDates.Connection.Close();

the reader works fine but the result is the last row only

i want to get all rows and set it as AnnuallyBoldedDates on monthCalender

thanks in Advance