AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Stephen Jackson
Expertise
I can help with questions regarding VB.NET syntax and object references, with data interfaces and with the design and creation of robust, data aware object classes. I can also be very helpful with creating distributable applications and provide tricks and tips on .msi creation. I also have extensive experience in designing SQL Server Databases and interfacing them with VB.NET. I try to avoid web specific questions, as that is an area of expertise all its own.

Experience

Experience in the Area:
I have been a programmer in Visual Basic since version 1.0 and have worked with VB.NET (which is infinitely more powerful than previous versions) since its initial release and SQL Server, both as a corporate IT professional and professional consultant. I first wrote Basic in 1976 on a TRS 80 and have worked in Visual Basic 1.0 and every subsequent release of Microsoft Visual Basic. I worked for over 7 years as a Senior Level Consultant in the area and currently hold a Project Manager position in IT.

Education and Credentials:
MBA in Econometrics, 1983, University of Memphis. BBA in Financial Management, 1982, Fogelman College of Business and Economics, University of Memphis.
Microsoft Certified Professional

Areas of Special Expertise:
My specialty is the design of Object Oriented Solutions with robust, data aware object classes. I generally avoid the classic ‘Three Tier’ model as I find it redundant and cumbersome to maintain. I also specialize in the creation of ‘User Friendly’ User Interfaces which help lessen the need for user training and help prevent user error. I work best with Windows Forms based applications, and while I do work in C# as well, I prefer to limit my questions here to Windows Forms based applications created in Visual Basic.NET and SQL Server. I wil also address questions relating to the distribution and installation of Windows Forms based applications created in VB.NET.
 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > Data Reader bug

Topic: VB.NET



Expert: Stephen Jackson
Date: 6/2/2008
Subject: Data Reader bug

Question
Hi Stephen how are you? Concerning the code that i have sent to you, well you helped me a lot but there is still a little thing also. I wonder if you can help me with this task:   

  In the debug i get when i click a checkbox for the Private Sub loadskillset , the syntax highlighted "while (skillsetReader.read())": invalid attempt to call read when reader is closed   Besides, when i click a second checkbox, i get in the Private sub appGrpchk_checkedChanged, the syntax highlighted: Adapt.Fill(ds,"AppGrpObj"), the following error: There is already an open DataReader associated with this command which must be closed first.   Can you help me with this please?

Answer
Carolina,

First, I apologize for taking so long! My (FIOS) Internet router went down this week and I just got a new one this afternoon!

OK, what you are seeing there is a call to a valid but closed datareader.  I suspect this is a matter of order in which various objects are 'clicked' and so in the order in which your code is called.  I would recommend the following ....

Go ahead and declare your DataReader objects at the top (general declarations).  Then for each handler (action taken when a form object is clicked, button pressed, etc.) Set the DataReader then, let your code use it, and then close it so that another piece of code does not generate an error trying to open it again.  This way you will always have a 'fresh' data reader and should not see errors.  I know it is more code, but this kind of form code can be very ticklish ... almost as much as me! ;c)

Thanks!

Stephen

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.