Solved

ComboBox DropDownList Problem

Posted on 2006-06-15
3
748 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
Comment Utility
try to use stored procedure

it will improve performance
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
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.
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 shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

11 Experts available now in Live!

Get 1:1 Help Now