Solved

ComboBox DropDownList Problem

Posted on 2006-06-15
3
751 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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Video Player 2017 5 35
Graphics 2 32
Calculate number of nights between two dates 5 53
"Emulate" TAB key when press Enter Key 3 44
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

791 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