经验:SQL Server Compact 出现的错误解决方法. There was an error parsing the query

 调试SQL Server Compact3.51 SP1数据库程序,当调试到

 

  StringBuilder strSql=new StringBuilder();
  strSql.Append("SELECT TOP 1 Q_ID,Q_Name,Q_Unit,Q_Default,SectorNo,StartPos,DataSize FROM QualityIndex ");
  strSql.Append("WHERE Q_Name=@Q_Name ");

  SqlCeParameter[] parameters = {
             new SqlCeParameter("@Q_Name", SqlDbType.NVarChar,48)};

    parameters[0].Value = Q_Name;

             using (SqlCeConnection connection = new SqlCeConnection(connectionString))
            {
                SqlCeCommand cmd = new SqlCeCommand();
                PrepareCommand(cmd, connection, null, strSql.ToString(), parameters);
                SqlCeDataAdapter da = new SqlCeDataAdapter(cmd);
              
                DataSet ds = new DataSet();
              
                da.Fill(ds, "ds2"); //出现错误 There was an error parsing the query ,不知道为什么?后来将TOP 1去掉就不出现错误了,不知道这是为什么?各位老大哪位又遇到过?还有一个修改的地方预先的SQL 都是小写改为大写。
               

                cmd.Parameters.Clear();
              
                return ds;
              
            }

你可能感兴趣的:(Linux/WinCE)