This is a migrated thread and some comments may be shown as answers.

give me some advice on search speed which method is the best

0 Answers 29 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 01 Mar 2016, 09:24 AM

Hello

in a combobox the user writes the city and the program should search for this city according to written characters obviously do a search in a sql table that has over 9000 records. I set of keywords to speed everything but I ask you, which of the two methods of code is more powerful?

 

Protected Sub luogoresidenza_ItemsRequested(sender As Object, e As RadComboBoxItemsRequestedEventArgs) Handles luogoresidenza.ItemsRequested
        Using Context As New touristEntities
                If Not [String].IsNullOrEmpty(e.Text) Then
                    Dim Query = (From c In Context.Tab_comuni_nazioni
                                 Where c.c_descrizione.StartsWith(e.Text)
                                 Order By c.c_descrizione
                                 Select c.c_idrecord, c.c_descrizione).ToList
 
                    Dim query1 = Query.Skip(e.NumberOfItems).Take(10)
                    luogoresidenza.DataSource = query1
                    luogoresidenza.DataBind()
 
                    Dim endOffset As Integer = e.NumberOfItems + query1.Count()
                    Dim totalCount As Integer = Query.Count()
 
                    If endOffset = totalCount Then
                        e.EndOfItems = True
                    End If
 
                    e.Message = [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, totalCount)
                End If
        End Using
    End Sub

Or better to use a web service?

 

 

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
Fabio Cirillo
Top achievements
Rank 1
Share this question
or