Better way of loading data RRS feed

  • Question

  • Hi all, this is my first time developing windows ce app with VS2005. I find that loading data in the emulator be particularly slow and takes more than 5 second to just retrieve a single record. I am not sure if this is normal as my previous experience with desktop application is faster. Below is a sample code I used to retrieve name from my database that I would load into a combobox.

    Is loading data slow a norm in windows ce development?Is there any other better way of doing it?Any suggestion would be appreciated.

            Public Function GetName(ByVal name As Names) As DataSet
                Dim cmdText As String = String.Empty
                cmdText = "select * from Names where firstName = @firstname and lastName = @lastname"
                Dim da As New SqlCeDataAdapter(cmdText, connectionstring)
                da.SelectCommand.CommandType = CommandType.Text
                da.SelectCommand.Parameters.Add("@firstname", SqlDbType.NVarChar).Value = name.firstname
                da.SelectCommand.Parameters.Add("@lastname", SqlDbType.NVarChar).Value = name.lastname
                Dim ds As New DataSet
                Return ds
            End Function

    Sunday, June 17, 2012 8:54 AM


  • Hi,

    Better to mention column names what you required in a select statement.

    Don't use  * with select statement it will reduce the Query performance.

    To understand run the below Query and Check the query completion time


    SELECT Col1,Col2 from Names where firstName = 'AA' and lastName = 'BB'

    Don't do:-

    SELECT * from Names where firstName = 'AA' and lastName = 'BB'

    PS.Shakeer Hussain

    • Marked as answer by Jesse Jiang Tuesday, July 10, 2012 8:15 AM
    Sunday, June 17, 2012 11:30 AM