Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Loading ComboBox2 with Selected Information from ComboBox1

Right now

I am loading Combobox 1 with customer codes on teh form load.

Now in the event where the index is changed I want to load Combobox2 using the information that was selected in ComboBox 1

for eg.

on form load combobox1 is populated with customer code names

when a user selects a customer code name combobox2 will be populated with all the order numbers and then when the user selects the order number it will populate the rest of my form according to the values in combobox 1 and combobox 2


But I get this error.

"There is already an open DataReader associated with this Connection which must be closed first."


I can get around this error if I have a button that loads the rest of the form.  But I rather load the rest of the form once Combobox2 item is selected

0
foobarr
Asked:
foobarr
2 Solutions
 
SanclerCommented:
I think we need to see the code, involving the datareader/s, which loads the comboboxes and form.  That, from the error message, is where the problem lies and what you may be loading from the datareader/s doesn't really tell us much about how you are handling it/them.  And whether you're using VB.NET 2002, 2003 or 2005 might be helpful to know.

Roger
0
 
g_johnsonCommented:
somewhere you are re-using a datareader, but not closing it first

like,

while rdr1.read
    '' doing something
loop

rdr1.close   <----------------- this is mising

0
 
foobarrAuthor Commented:
the error was coming from a Fill command.

I think the problem was that I was querying the same table but different fields using differen queries, and it was doing it at the same time.  

So I cheated and in my combobox1 I checked if it was done populating, if it was I then populate the next combobox, and somehow that worked...


I was using that query with all of my other forms so it was odd that it didn't work in this instance.  

Maybe its something I need to look into later on especially during the testing phase...The problem is I didn't write that query method so I probably will have to go through agin later on
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now