Solved

ComboBox DropDownList Problem

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

726 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