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

1 posts, 0 answers
  1. Fabio Cirillo
    Fabio Cirillo avatar
    181 posts
    Member since:
    Jan 2010

    Posted 01 Mar 2016 Link to this post


    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
                        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?



Back to Top