inetworks
asked on
Combo box binding slow - vb.net
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.C ount > 0 Then
cbCompanyname.DataSource = dsCompany.Tables("dtCompan y")
cbCompanyname.DisplayMembe r = "companyname"
cbCompanyname.ValueMember = "companycode"
cbCompanyname.SelectedInde x = -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
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
daCompany = New SqlDataAdapter("SELECT companycode,companyname from qry_syncompanymain order by companyname", conBncclient)
daCompany.Fill(dsCompany, "dtCompany")
If dsCompany.Tables(0).Rows.C
cbCompanyname.DataSource = dsCompany.Tables("dtCompan
cbCompanyname.DisplayMembe
cbCompanyname.ValueMember = "companycode"
cbCompanyname.SelectedInde
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.