sql mobile error

Posts   
 
    
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 26-Jul-2006 03:26:33   

I'm getting a time out from sql mobile with the compact templates. I can't seem to figure out what it is. Do you have any ideas.

sql mobile 2005 framework 2.0 adapter templates c# keepconnectionopen is true, i'm passing the connection string to each adapter constructor.

It times out on a simple entity fetch. the error is

NotSupportedError CommandTimeout

error stack is

"at System.Data.SqlServerCe.SqlCeCommand.set_CommandTimeout()\r\nat SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateCommand()\r\nat SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ()\r\nat SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ()\r\nat SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreatePagingSelectDQ()\r\nat SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ()\r\nat SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateSelectDQ()\r\nat SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter()\r\nat SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntity()\r\nat NeoPocketDiary.SystemSettings.ReturnSystemSetting()\r\nat NeoPocketDiary.frmStartup.UserLabel()\r\nat NeoPocketDiary.frmStartup..ctor()\r\nat NeoPocketDiary.frmMain.frmMain_Load()\r\nat System.Windows.Forms.Form.OnLoad()\r\nat System.Windows.Forms.Form._SetVisibleNotify()\r\nat System.Windows.Forms.Control.set_Visible()\r\nat System.Windows .Forms.Application.Run()\r\nat NeoPocketDiary.ProgramStart.Main()\r\n"

Thanks!

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 26-Jul-2006 07:42:55   

What happens when you try KeepConnectionOpen = false? Also did you try to set the Adapter.CommandTimeOut to a value bigger than the 30 sec default value?

jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 26-Jul-2006 13:49:20   

Walaa wrote:

What happens when you try KeepConnectionOpen = false? Also did you try to set the Adapter.CommandTimeOut to a value bigger than the 30 sec default value?

It breaks with command timeout to false also. I started with it that way, but the docs said to use true for mobile so I tried that also.

I haven't tried commandtimeout to bigger than 30. That's really not a solution. I can't make people sit there and wait that long every db call. I'll try it and see if it works though.

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 26-Jul-2006 14:42:17   

It doesn't break at query execution time. It crashes in this routine:

protected override IDbCommand CreateCommand()
{
    IDbCommand toReturn = new SqlCeCommand();
    toReturn.CommandTimeout = DynamicQueryEngine.CommandTimeOut;

    return toReturn;
}

as shown in the stacktrace.

Checking the error exception, you get the exception "NotSupported exception". This is thrown when command timeout is set to a value != 0. According to reflector.

Please set the timeout to 0 in the DataAccessAdapter.

This is a bug in the SqlCEServerDQE. You can work around it by setting the CommandTimeout to 0 on the used dataaccessadapter, which by default set the command timeout to 30. This exception was added for SqlMobile (Sqlserver CE v3.0). SqlServer CE 2.0 doesn't have this exception, hence why it slipped through the cracks.

Frans Bouma | Lead developer LLBLGen Pro
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 28-Jul-2006 01:09:25   

Otis wrote:

It doesn't break at query execution time. It crashes in this routine:

protected override IDbCommand CreateCommand()
{
    IDbCommand toReturn = new SqlCeCommand();
    toReturn.CommandTimeout = DynamicQueryEngine.CommandTimeOut;

    return toReturn;
}

as shown in the stacktrace.

Checking the error exception, you get the exception "NotSupported exception". This is thrown when command timeout is set to a value != 0. According to reflector.

Please set the timeout to 0 in the DataAccessAdapter.

This is a bug in the SqlCEServerDQE. You can work around it by setting the CommandTimeout to 0 on the used dataaccessadapter, which by default set the command timeout to 30. This exception was added for SqlMobile (Sqlserver CE v3.0). SqlServer CE 2.0 doesn't have this exception, hence why it slipped through the cracks.

That didn't seem to work. Am I doing it wrong?


SystemSettingsEntity ent = new SystemSettingsEntity(settingName.ToString());
            using (DataAccessAdapter adapter = new DataAccessAdapter(Global.GetConnectionString()))
            {
                adapter.CommandTimeOut = 0;
                if (adapter.FetchEntity(ent))
                {
                    return ent.SettingValue;
                }
                else
                {
                    return defaultValue;
                }
                
            }       

Thanks

jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 28-Jul-2006 01:25:09   

never mind. I got the latest runtime version and it works.

Thanks!