Getscalar AggregateFunction.max in SQLCE

Posts   
 
    
jspruit
User
Posts: 17
Joined: 11-Nov-2005
# Posted on: 01-Dec-2005 15:00:27   

HI,

I'm doing the following in a CF SQLCE adapter project:

maxrow = Convert.ToInt16(adapter2.GetScalar(EntityFieldFactory.Create(TubeFieldIndex.TubeRow), AggregateFunction.Max));

i get error cannot error cannot convert from 'object' to 'bool'.

When i try the same in a normal windows application this works fine.

Anybody knows how to work around this ?

Thanx in advance.

Jan

Paul.Lewis
User
Posts: 147
Joined: 22-Aug-2005
# Posted on: 02-Dec-2005 04:19:42   

jspruit wrote:

HI,

I'm doing the following in a CF SQLCE adapter project:

maxrow = Convert.ToInt16(adapter2.GetScalar(EntityFieldFactory.Create(TubeFieldIndex.TubeRow), AggregateFunction.Max));

i get error cannot error cannot convert from 'object' to 'bool'.

When i try the same in a normal windows application this works fine.

Anybody knows how to work around this ?

Thanx in advance.

Jan

Jan,

I don't know that I can answer your question with the information provided. What I do have are lots of questions for you...

Can you please post a more complete example?
What datatype is maxrow? I would assume it to be an integer. Does the line listed above throw the error?
Is the error on the convert or the GetScalar or the Create function? Can you provide the stack trace that accompanies the error?

Answering these questions for yourself may provide an answer. If not please post additional information and we will help you figure it out.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39617
Joined: 17-Aug-2003
# Posted on: 02-Dec-2005 11:35:17   

Additionally, if you do: object o = adapter2.GetScalar...

does that work? if so, what is the type of o?

Frans Bouma | Lead developer LLBLGen Pro
jspruit
User
Posts: 17
Joined: 11-Nov-2005
# Posted on: 02-Dec-2005 13:14:10   

Hi,

I discovered what the reason is.

Query executed:

SELECT TOP 1 MAX("tube"."tubeRow") as "TubeRow" from "tube"

I tried this in SQL server, this works fine.

When i try this in SQLCE it doesn't work because of "TOP 1"

When i remove "TOP 1" query works fine with same result

Don't know if this needs to be altered in LLBL template for SQLCE ???

Regards,

Jan

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39617
Joined: 17-Aug-2003
# Posted on: 02-Dec-2005 14:02:04   

jspruit wrote:

Hi,

I discovered what the reason is.

Query executed:

SELECT TOP 1 MAX("tube"."tubeRow") as "TubeRow" from "tube"

I tried this in SQL server, this works fine.

When i try this in SQLCE it doesn't work because of "TOP 1"

When i remove "TOP 1" query works fine with same result

Don't know if this needs to be altered in LLBL template for SQLCE ???

Regards,

Jan

Good catch! I'll adjust the DQE for CE and will release a patch today. It appears 'TOP' isn't supported. I'll remove it from the query generator for CE. Strange that I didn't see that in the list of features not supported on CE.

Frans Bouma | Lead developer LLBLGen Pro
jspruit
User
Posts: 17
Joined: 11-Nov-2005
# Posted on: 02-Dec-2005 14:04:28   

Thanks for the fast support !! simple_smile

Regards,

Jan

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39617
Joined: 17-Aug-2003
# Posted on: 02-Dec-2005 14:47:59   

It's available simple_smile

Frans Bouma | Lead developer LLBLGen Pro