"SqlCeCommand.CommandTimeout does not support non-zero values."

Posts   
 
    
Posts: 8
Joined: 09-Jun-2008
# Posted on: 10-Jun-2008 17:56:46   

I am using a .NET 3.5 app with Sql Server Compact 3.5, and when attempting to fetch an entity, I get the error

"SqlCeCommand.CommandTimeout does not support non-zero values."

my App.config is as follows:

<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="Main.ConnectionString" value="data source=c:\CompactBullon.sdf;"/> <add key="SqlServerDQECompatibilityLevel" value="4" /> </appSettings> </configuration>

the DBConnection.GetAdapter is:

    public static DataAccessAdapter GetAdapter()
    {
        return new DataAccessAdapter("Data Source=C:\\CompactBullon.sdf");
    }

and I get the error in my "FetchEmployee" function:

 public static EmployeeEntity FetchEmployee(Int32 id)
    {
        EmployeeEntity employee = new EmployeeEntity(id);
        IPrefetchPath2 prefetchPath = EmployeePrefetchPath;

        using (DataAccessAdapter adapter = DBConnection.GetAdapter())
        {
            adapter.FetchEntity(employee, prefetchPath);
        }

        return employee;
    }

the call to the function is:

EmployeeEntity employee = EmployeeEntityManager.FetchEmployee(91);

there is employee in the employee table with id 91.

If I comment out the prefetch path, I get the same error.

the template binding that was at the top of the list when the code was generated was:

SD.TemplateBindings.SqlServerSpecific.NET20

I am using the LLBL 2.6 Demo.

the stack trace is as follows:

" at System.Data.SqlServerCe.SqlCeCommand.set_CommandTimeout(Int32 value)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.Query.SetCommandTimeout(Int32 timeoutInterval)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.PrepareQueryExecution(IQuery queryToExecute, Boolean forceConnectionSet)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteSingleRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFields2 fieldsToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfos, IRelationPredicateBucket filter)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityUsingFilter(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, IRelationPredicateBucket filter, ExcludeIncludeFieldsList excludedIncludedFields)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntity(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)\r\n at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntity(IEntity2 entityToFetch, IPrefetchPath2 prefetchPath)\r\n at P09X.EmployeeEntityManager.FetchEmployee(Int32 id) in C:\\Projects\\P09X\\EmployeeEntityManager.cs:line 58\r\n at P09X.Form1.btnRunReport_Click(Object sender, EventArgs e) in C:\\Projects\\P09X\\Form1.cs:line 32\r\n at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n at System.Windows.Forms.Button.OnClick(EventArgs e)\r\n at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)\r\n at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.ButtonBase.WndProc(Message& m)\r\n at System.Windows.Forms.Button.WndProc(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)\r\n at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms. UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n at System.Windows.Forms.Application.Run(Form mainForm)\r\n at P09X.Program.Main() in C:\\Projects\\P09X\\Program.cs:line 17\r\n at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Threading.ThreadHelper.ThreadStart()"

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39618
Joined: 17-Aug-2003
# Posted on: 10-Jun-2008 18:30:52   

I think this is a bug.

Workaround:


public static DataAccessAdapter GetAdapter()
{
    DataAccessAdapter toReturn = new DataAccessAdapter("Data Source=C:\\CompactBullon.sdf");
    toReturn.CommandTimeOut = 0;
    return toReturn;
}

We'll work on a fix for this. It's still strange though, our CE linq tests ran OK (as long as CE Desktop's crippled SQL engine could cope with the queries of course wink ). I'll check what's the best fix for this and will release an update.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 8
Joined: 09-Jun-2008
# Posted on: 10-Jun-2008 19:18:53   

hey, thanx alot Frans smile ...its always great service with you guys!

only mod I had to make to the workaround was to move the "toReturn.CommandTimeOut = 0" to the line before "new DataAccessAdapter"

keep up the great work! sunglasses

Posts: 8
Joined: 09-Jun-2008
# Posted on: 10-Jun-2008 19:28:10   

whoops, my bad... in your code sample you can't move the "toReturn.CommandTimeout = 0" to before "new DataAccessAdapter" because it would cause a null reference exception... it worked on my sample cuz I get the new adapter, then set the timeout, and then fetch... sorry for confusing your users !confused

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39618
Joined: 17-Aug-2003
# Posted on: 10-Jun-2008 19:31:18   

heh simple_smile

No problem CodeBlaster simple_smile Glad it's now sorted.

One tip with CE Desktop: it's not really a good database, so if you for example use scalar queries in the select, you might run into errors inside CE Desktop. So I'd opt for sql express

Frans Bouma | Lead developer LLBLGen Pro
Posts: 8
Joined: 09-Jun-2008
# Posted on: 10-Jun-2008 19:35:45   

ok, thanx for the advicesunglasses

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39618
Joined: 17-Aug-2003
# Posted on: 11-Jun-2008 10:33:57   

Fixed in next build.

Frans Bouma | Lead developer LLBLGen Pro