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:
Dim db As New Database.SQLDatabase("User ID=test;Password=test;Initial Catalog=QuikFix;Data Source=test;") Dim dr As SqlDataReader Dim da As SqlDataAdapter Dim ds As DataSet db.SetSQLDBCommand("select_ticket_by_id") 'pass procedure name db.AddSQLDBCmdParameter("@TicketID", SqlDbType.BigInt, 3357) 'pass a parameter dr = db.UseSQLDBExecuteReader() 'grab the data [B] While dr.Read()[/B] MsgBox(dr("TicketID")) End While dr.Close() db.SetSQLDBCommand("select_ticket_ids") 'another procedure db.AddSQLDBCmdParameter("@ClientID", SqlDbType.Int, 1) 'parameters db.AddSQLDBCmdParameter("@FacilityID", SqlDbType.BigInt, 1) db.AddSQLDBCmdParameter("@bOpen", SqlDbType.Bit, 1) db.AddSQLDBCmdParameter("@bOnHold", SqlDbType.Bit, 1) dr = db.UseSQLDBExecuteReader() 'execute it While dr.Read() MsgBox(dr("TicketID")) End While dr.Close() db.SetSQLDBCommand("select_ticket_by_id") 'procedure db.AddSQLDBCmdParameter("@TicketID", SqlDbType.BigInt, 3357) 'param ds = db.UseSQLDBDataSet() 'works with datasets as well Dim dd As New ComboBox Controls.Add(dd) With dd .DataSource = ds.Tables(0) .DisplayMember = "TicketID" .ValueMember = "TicketID" 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.




Reply With Quote