Solved

Loading ComboBox2 with Selected Information from ComboBox1

Posted on 2006-07-05
3
315 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

16 Experts available now in Live!

Get 1:1 Help Now