SQL CE GetDBCount() Problem

Posts   
 
    
mwolski
User
Posts: 30
Joined: 09-Aug-2004
# Posted on: 05-Aug-2006 17:08:25   

The following code produces an exception in SQL CE.

                CETestCollection coll = new CETestCollection();
                int n = coll.GetDbCount();

I get the exception:

An exception was caught duting the execute of a retrieval query: There was an error parsing the query. [ Token line number = 1, Token line offset = 39, Token in error = SELECT ]. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.

Here is the sql it generated:

Query: SELECT COUNT(*) AS NumberOfRows FROM (SELECT \"CETest\".\"MyText\" FROM \"CETest\") TmpResult

My test table in SQL CE (CETest) has just a single field:

Column  DataType    Length  AllowNulls  Unique   PrimaryKey
MyText   ntext        16            Yes           No            No

Info:

SQL Compact Framework 2.0 SP1 LLBLGen Pro 2.0 Aug 3rd

Michael

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 05-Aug-2006 17:47:29   

Hi Michael
Can you please try to execute your SQL

SELECT COUNT(*) AS NumberOfRows FROM (SELECT \"CETest\".\"MyText\" FROM \"CETest\") TmpResult

.

Also, please paste the full stack dump

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 05-Aug-2006 20:54:12   

This is indeed a known issue, SqlCE limitation.

Please rewrite the query as a scalar query, thus write a GetScalar() call which emits something like: SELECT COUNT(*) FROM CETest.

I'll rewrite the DQE method.

The DQE for CE isn't as well tested as other DQE's because unittests are impossible on CE, so every testing is done manually with a testapp. I missed this method.

Frans Bouma | Lead developer LLBLGen Pro
mwolski
User
Posts: 30
Joined: 09-Aug-2004
# Posted on: 05-Aug-2006 21:10:33   

Will do, and thanks for the help. Yes, I can see where if you cannot run unit tests the CE libs would be difficult to have completely tested. I will try to post anything I see while working on this short Windows Mobile project (and if there is anything I can test for you, just let me know).

So far, everything else I have touched appears to work well.

[Edit] Since its a known issue I didn't add the stack trace, but if you anyone wants it I will gladly do so, just let me know.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Aug-2006 13:17:31   

Added an exception throw to the next build.

Frans Bouma | Lead developer LLBLGen Pro