?
Solved

Combo box binding slow - vb.net

Posted on 2005-03-01
6
Medium Priority
?
448 Views
Last Modified: 2008-03-03
Hi guys,

My vb.net application is working very slow while binding combo box.
I am using the following code

      Dim dsCompany As New DataSet
      Dim daCompany As SqlDataAdapter
      conBncclient = New SqlConnection(objbncClient.conClient)
      daCompany = New SqlDataAdapter("SELECT companycode,companyname from qry_syncompanymain order by          companyname", conBncclient)
      daCompany.Fill(dsCompany, "dtCompany")

        If dsCompany.Tables(0).Rows.Count > 0 Then
            cbCompanyname.DataSource = dsCompany.Tables("dtCompany")
            cbCompanyname.DisplayMember = "companyname"
            cbCompanyname.ValueMember = "companycode"
            cbCompanyname.SelectedIndex = -1
        End If

Am i doing anything wrong?. There are around 8000 records in the table and it takes 4-5 seconds to bind the combo box.
Please help.

Thanks,

Anish

0
Comment
Question by:inetworks
[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
  • 2
6 Comments
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 13427641
I wonder if there could be any improvement in the code so that it takes less time. DataAdapters are a little faster but then if you need a dataset, you can do without it.
If it takes 4-5 secs just to bind, I mean if you take the Time Difference between the lines of codes for databinding then yes it is taking some time.
But if it is 4-5 secs for the whole process of creating and filling the dataset from the database and binding the combo, GUI display and all included. Then I think its fair enough.


0
 
LVL 34

Accepted Solution

by:
Brian Crowe earned 1000 total points
ID: 13428663
If the combobox is readonly then i would recommend a datareader instead of a dataadapter...they're faster.
0
 
LVL 19

Assisted Solution

by:arif_eqbal
arif_eqbal earned 1000 total points
ID: 13436140
I am sorry in the above post I meant datareader only, he is already using a DataAdapter....
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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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