locked
SQL query very slow retreiving data from database RRS feed

  • Question

  • I have an Intermec barcode scanner and develop an app. I create CAB and install it on the device. After the scan an SQL  query is to be started. But the inquiries lasts very slowly 1-5 sec. SELECT query to 2 sec, UPDATE to 5 sec. 

    Database on the SQL Server 2008, Wifi network , windows mobile 6.5 prof., C#, .net cf 3.5.

    But when I connect the Intermec device via dock directly to PC (LAN network) and start debug direct from VS2008, the query is executed in less <1 sec.

    I would like to know where the reason is, because when the query execute on the device and execute over VS2008, the performance is bad?

    How can I speed up the queries? Where is the problem, network, device performance, SQL server, app ???

    public DataSet getDataAdapterLeitID(string ID)  {
                try {
                    String strSQL = "SELECT .......... FROM  .... INNER JOIN ... ON ... = ... WHERE (... = " + ID + " ) "ORDER BY ....";
                    SqlDataAdapter da = new SqlDataAdapter(strSQL, connectionString);
                    DataSet ds = new DataSet();
                    da.Fill(ds);
                    return ds;
                } catch (Exception e) {
                    MessageBox.Show("getDataAdapterLeitID Error : " + e.Message);
                    return null;
      }        }

    public void UpdateDB(......)
            {
                SqlConnection conn = new SqlConnection(connectionString);
                try{

                     string sqlUpdate = "UPDATE ....................";
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand(sqlUpdate, conn))
                    {
                        cmd.ExecuteNonQuery();
                    }
                    conn.Close();
                }  catch (Exception e)  {
                    MessageBox.Show("UpdateDB Error : " + e.Message);
                }
            }

    Friday, January 27, 2017 2:10 PM

All replies

  • Hi Dimitry,

    There are quite a few variables involved with any performance question. In this case if you are comparing a docked vs undocked access to a database I would suggest that the difference is a direct result of the wireless bandwidth being less efficient than the direct wired ethernet connection available to the device while it is docked.

    Sincerely,

    IoTGirl

    Friday, January 27, 2017 5:59 PM
  • Hi Girl,

    What can it be, please explain, I get a thought impulse.
    Does anyone have any ideas?

    Monday, January 30, 2017 9:58 AM
  • Hi Dimitry,

    Your internet connection is much faster when your device is cradled so that is most likely the reason the query and any network related interaction is faster when the device is docked.

    Sincerely,

    IoTGirl

    Monday, January 30, 2017 5:31 PM