Connecting to SQL Server Compact database forces exception.

Apr 4, 2011 at 11:02 PM

Independently from version of SQL Server Compact (3.5 or 4.0) it forces exception.

Connection string:

Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=C:\Northwind.sdf

 

Under debug in VS 2010 SP1 it works fine. But it fails if it was installed with elevated trust and run out of browser.

 

---------------------------

---------------------------
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. ---> MS.Internal.ComAutomation.ComAutomationObjectException: Error HRESULT E_FAIL has been returned from a call to a COM component.

(Source=Microsoft SQL Server Compact OLE DB Provider)

   at MS.Internal.ComAutomation.ComAutomationNative.CheckInvokeHResult(UInt32 hr, String memberName, String exceptionSource, String exceptionDescription, String exceptionHelpFile, UInt32 exceptionHelpContext)

   at MS.Internal.ComAutomation.ComAutomationNative.Invoke(Boolean tryInvoke, String memberName, ComAutomationInvokeType invokeType, ComAutomationInteropValue[] rgParams, IntPtr nativePeer, ComAutomationInteropValue& returnValue)

   at MS.Internal.ComAutomation.ComAutomationObject.InvokeImpl(Boolean tryInvoke, String name, ComAutomationInvokeType invokeType, Object& returnValue, Object[] args)

   at MS.Internal.ComAutomation.ComAutomationObject.Invoke(String name, ComAutomationInvokeType invokeType, Object[] args)

   at System.Runtime.InteropServices.Automation.AutomationMetaObjectProvider.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)

   at System.Runtime.InteropServices.Automation.AutomationMetaObjectProviderBase.<.cctor>b__4(Object obj, InvokeMemberBinder binder, Object[] args)

   at CallSite.Target(Closure , CallSite , Object )

   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid1[T0](CallSite site, T0 arg0)

   at ComToolkit.Data.AdoConnection.Open()

   at Test.MainPage.ButtonConnect_Click(Object sender, RoutedEventArgs e)
---------------------------
OK  
---------------------------