I asked a question yesterday and suddenly before I got down to the answer the app was working fine, went good through many tests...Now it blows up again complaining that the datareader cannot be read because it is closed...How so?

here is the calling code:

VB Code:
  1. Dim db As New Database.SQLDatabase("User ID=test;Password=test;Initial Catalog=QuikFix;Data Source=test;")
  2.  
  3.         Dim dr As SqlDataReader
  4.         Dim da As SqlDataAdapter
  5.         Dim ds As DataSet
  6.  
  7.         db.SetSQLDBCommand("select_ticket_by_id") 'pass procedure name
  8.         db.AddSQLDBCmdParameter("@TicketID", SqlDbType.BigInt, 3357) 'pass a parameter
  9.         dr = db.UseSQLDBExecuteReader() 'grab the data
  10.  
  11. [B]        While dr.Read()[/B]
  12.             MsgBox(dr("TicketID"))
  13.         End While
  14.         dr.Close()
  15.  
  16.         db.SetSQLDBCommand("select_ticket_ids") 'another procedure
  17.         db.AddSQLDBCmdParameter("@ClientID", SqlDbType.Int, 1) 'parameters
  18.         db.AddSQLDBCmdParameter("@FacilityID", SqlDbType.BigInt, 1)
  19.         db.AddSQLDBCmdParameter("@bOpen", SqlDbType.Bit, 1)
  20.         db.AddSQLDBCmdParameter("@bOnHold", SqlDbType.Bit, 1)
  21.  
  22.         dr = db.UseSQLDBExecuteReader() 'execute it
  23.  
  24.         While dr.Read()
  25.             MsgBox(dr("TicketID"))
  26.         End While
  27.         dr.Close()
  28.  
  29.         db.SetSQLDBCommand("select_ticket_by_id") 'procedure
  30.         db.AddSQLDBCmdParameter("@TicketID", SqlDbType.BigInt, 3357) 'param
  31.         ds = db.UseSQLDBDataSet() 'works with datasets as well
  32.  
  33.         Dim dd As New ComboBox
  34.         Controls.Add(dd)
  35.  
  36.         With dd
  37.             .DataSource = ds.Tables(0)
  38.             .DisplayMember = "TicketID"
  39.             .ValueMember = "TicketID"
  40.         End With

It errors out in the first while loop when it tries to read dr.
Ill post the SQLDatabase class in a seperate reply to this post since it is lengthy.