Solved

Loading ComboBox2 with Selected Information from ComboBox1

Posted on 2006-07-05
3
317 Views
Last Modified: 2010-04-23
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
Comment
Question by:foobarr
3 Comments
 
LVL 34

Assisted Solution

by:Sancler
Sancler earned 250 total points
ID: 17043832
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
 
LVL 4

Accepted Solution

by:
g_johnson earned 250 total points
ID: 17044416
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
 
LVL 7

Author Comment

by:foobarr
ID: 17050926
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now