Sql Server Compact Edition 3.5

Posts   
 
    
mtran
User
Posts: 7
Joined: 29-Oct-2008
# Posted on: 29-Oct-2008 06:08:39   

Hi,

I'm using LLBL 2.6 and have followed the instructions from the manual to generate code for SSCE 3.5 as follow:

"To be able to target SqlServer CE Desktop, you first has to create a SqlServer project, similar to what you have to do for CF.NET support. "

The generated code has references to the following libraries:

  • SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll
  • SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll

When I ran this line of code in my application:

adapter.SaveEntity(entity, true);

The following error message appeared:

" An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

The connection string I have is as follow:

<add name="Main.ConnectionString" connectionString="Data Source=C:\Development\LLBL\SSCE35.sdf;"/>

Your help is appreciated.

mtran
User
Posts: 7
Joined: 29-Oct-2008
# Posted on: 29-Oct-2008 06:16:46   

Oh btw, here is more info about my environment:

  • I'm trying to generate code for SSCE 3.5 Desktop
  • .NET 2.0
  • Visual Studio 2008
mtran
User
Posts: 7
Joined: 29-Oct-2008
# Posted on: 29-Oct-2008 07:55:14   

This may help as well, here is the stack trace:

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.OpenConnection() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.StartTransaction(IsolationLevel isolationLevelToUse, String name) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave, IPredicateExpression updateRestriction, Boolean recurse) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave) at WCFApplication1.DataAccessHelper.SavePersonEntity(String firstName, String lastName) in C:\Dev\WindowsFormsApplication1\WCFApplication\DataAccessHelper.cs:line 25

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 29-Oct-2008 08:34:56   

You should set the DQE Compatibility mode to 4, did you do that?

Also check this:

docs wrote:

SqlServerCe provider registration It's no longer necessary to reference System.Data.SqlServerCe.dll, however on the machine the application is ran which uses compatibility level 3 or 4, this dll has to be installed as documented in the SqlServer CE Desktop documentation about deployment: via the .msi shipped with SqlServer CE Desktop. If you can’t run this .msi installer, be sure your application’s .config file contains the appropriate provider registration for the DbProviderFactory. (this information is installed in the machine.config file by the .msi installer of SqlServer CE Desktop). More details about this are available in the SqlServer CE Desktop documentation (the 'Books online' documents of SqlServer CE Desktop)

mtran
User
Posts: 7
Joined: 29-Oct-2008
# Posted on: 29-Oct-2008 23:46:16   

Thanks a lot. That did the trick simple_smile