Solved

ComboBox DropDownList Problem

Posted on 2006-06-15
3
754 Views
Last Modified: 2008-01-09
Hi

I have a SQL ststement which I run as a SQLCommand and retrieve records to a dataset. I go through the records and add all the WorkOrderId's to the dropdown for the ComboBox. There are 10,000 WorkOrderID's, while it is trying to add the IDs to the dropdown list, the program freezes. The list adds after a while, but on clicking the combobox the takes a while to display the dropdown list.

The SQL statement is

String sSQL = "SELECT OPERATION.WORKORDER_BASE_ID AS WorkOrderID, "+

"WORK_ORDER.PART_ID AS PartID, PART.DESCRIPTION AS PartDesc "+

"FROM OPERATION INNER JOIN WORK_ORDER ON OPERATION.WORKORDER_TYPE = WORK_ORDER.TYPE AND "+

"OPERATION.WORKORDER_BASE_ID = WORK_ORDER.BASE_ID "+

"INNER JOIN "+

"PART ON WORK_ORDER.PART_ID = PART.ID WHERE(SUBSTRING(OPERATION.WORKORDER_TYPE, 1, 1) = 'w') "+

"AND (SUBSTRING(OPERATION.RESOURCE_ID, 1, 1) = '6') "+

"GROUP BY OPERATION.WORKORDER_BASE_ID, "+

"WORK_ORDER.PART_ID, PART.DESCRIPTION "+

"ORDER BY OPERATION.WORKORDER_BASE_ID ";

SqlConnection con = Connection();

SqlCommand comm = new SqlCommand(sSQL, con);

 Code to add the contents of DataSet to ComboBoxEdit(from Developer Express) Dropdown list:

for (int i = 0; i < dsWID.qryWorkOrderID.Count; i++)

{

cboWorkOrderID.Properties.Items.Add(dsWID.qryWorkOrderID.WorkOrderID);

}

Another thing is that I want to bind all the controls and datgridview to a navigator control. But the controls come from three different datasets. And these are dropdownlists. Please provide suggestions as how I can improve the performance. Any suggestions will be appreciated.

Thanks
0
Comment
Question by:phadavid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:gemailj
ID: 16913342
try to use stored procedure

it will improve performance
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 16913698
10,000 items in a combobox is not, in my opinion, a reasonable user interface.  It will take a long time to populate and a long time to render.  The SQL is not the problem here, it is the UI.

Is there any logical groupinbg of the items that would help?
0
 

Author Comment

by:phadavid
ID: 16914295
The 10000 items are for all the WorkOrder ID, i have looked into other controls but the user wants a dropdown list to see previous Work Orders. Coupling this problem with the need for the user needs navigation capabilities along with the dropdown list has made things even more complicated.

I have thought of something but don't know how to implement, i was reading up on t-sql and found Set Rowcount =1000, this helps with the performance problem but i don't know how to display the IDs when the user has reached 1000, there should be some way i can update the comboBox.

Please provide suggestions and tips

Thanks
Ashish
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 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