Hello,
Have you tried closing the reader after your while clause is closed?
while (reader.Read())
{
string ticketDateString = reader.IsDBNull(0) ? string.Empty : reader.GetString(0);
DateTime ticketDate = Convert.ToDateTime(ticketDateString);
int userId = reader.IsDBNull(1) ? -1 : reader.GetInt32(1);
int totalTickets = reader.IsDBNull(2) ? 0 : reader.GetInt32(2);
Ticket ticket = new Ticket(totalTickets, ticketDate, userId,string.Empty);
listTicket.Add(ticket);
}
reader.close()
or you may want to try to pur reader.close in a 'finaly' clause of your 'try catch' .
There is a difference between disposing the reader and closing it. And I'm also guessing you have to close the connection after you close the reader. Otherwise you would get the error indicating that it is in use by a reader.
May be that is what causing the trouble.
Regards,