I'm experiencing a very slow performance while filling a combobox, is this normal?
I'm reading a db with 78000+ rows, it's indexed in those fields i'm filtering.
Here is the code i'm using:
Fields "Marca" and "Modelo" are both primary keysCode:Dim conn As SqlCeConnection = Nothing If cmbMarca.SelectedIndex > 0 Then If cmbMarca.Text = "" Then Exit Sub Try conn = New SqlCeConnection("Data Source = " & GetAppPath() & "\DBs\Artigos.sdf") conn.Open() Application.DoEvents() Dim cmd As SqlCeCommand = conn.CreateCommand() Label1.Visible = True Cursor.Current = Cursors.WaitCursor Dim ceda As SqlCeDataAdapter = New SqlCeDataAdapter("SELECT DISTINCT Modelo FROM Artigos WHERE Marca='" & cmbMarca.Text & "' ORDER BY Modelo ASC", conn) Dim ds As New DataSet Application.DoEvents() ceda.Fill(ds, "Modelo") Application.DoEvents() cmbModelos.DataSource = ds.Tables("Modelo").DefaultView Application.DoEvents() cmbModelos.DisplayMember = "Modelo" Application.DoEvents() Cursor.Current = Cursors.Default Catch err As Exception MessageBox.Show(err.Message) Finally conn.Close() End Try End If
It's taking more then 4 minutes to return only 2 values from the database..



and rating it.
Reply With Quote