SQL查询很慢从数据库中检索数据
我有一台Intermec条形码扫描仪并开发了一款应用程序。我创建CAB并将其安装在设备上。扫描完SQL后 查询将被启动。但是查询持续1-5秒。 SELECT查询到2秒,UPDATE到5秒。
SQL Server 2008上的数据库,Wifi网络,windows mobile 6.5教授,C#,。net cf 3.5。
但是当我通过基站直接将Intermec设备连接到PC(LAN网络)并从VS2008直接启动调试时,查询执行时间小于
我想知道原因在哪里,因为当查询在设备上执行并在VS2008上执行时,性能不好?
如何加快查询速度? 问题出在哪里,网络,设备性能,SQL服务器,应用程序???
How can I speed up the queries? Where is the problem, network, device performance, SQL server, app ???
public DataSet getDataAdapterLeitID(字符串ID) {
尝试{
String strSQL =" SELECT .......... FROM .... INNER JOIN ... ON ... = ... WHERE(... =" + ID +")" ORDER BY ...." ;;
                SqlDataAdapter的DA =新的SqlDataAdapter(STRSQL,的connectionString);
                DataSet ds = new DataSet();
da.Fill(ds);
返回ds;
} catch(例外e){
MessageBox.Show(QUOT; getDataAdapterLeitID错误:" + e.Message);
            &NBSP ;  返回null;
}        }
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);
尝试{
public void UpdateDB(......)
{
SqlConnection conn = new SqlConnection(connectionString);
try{
string sqlUpdate =" UPDATE ...................." ;;
$
  ;         conn.Open();&
使用(的SqlCommand CMD =新的SqlCommand(SQLUPDATE,康涅狄格州))
              &NBSP ; {
                    cmd.ExecuteNonQuery();
}
conn.Close();
}  catch(例外e) {
MessageBox.Show(" UpdateDB Error:" + e.Message);
}
}
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);
}
}
嗨Dimitry,
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.
此致,
IoTGirl