Connecting to a remote SQL Server in CE project.

Posts   
 
    
Dusty
User
Posts: 24
Joined: 19-Feb-2008
# Posted on: 02-Sep-2008 17:47:59   

Version: 2.5 Final Runtime Library Version: 2.5.08.0122 Template: Adapter .NET Version: CF 2.0 Database: SQL Server 2000

I have an application running on Windows Mobile 6. I am attempting to make a remote SQL Server connection. I am not running on a native SQL CE database.

The application fails to make a database connection because it says that the connection string is invalid.

I am able to make a connection to the server if I manually set up a SqlConnection object. But the LLBLGen connection fails.

Am I missing something or does the framework not support this?

            string connectionString = "data source=sqlserver.remoteconnection.com;initial catalog=my_database;User ID=user_id;Password=password;persist security info=False;packet size=4096";
            
            // ERROR OCCURS HERE.
            DataAccessAdapter dataAccessAdapter = new DataAccessAdapter(
                connectionString,
                true
                );

            EntityCollection<CustomerEntity> customerEntityCollection = new EntityCollection<CustomerEntity>();

            dataAccessAdapter.FetchEntityCollection(
                customerEntityCollection,
                null
                );

            foreach (CustomerEntity customerEntity in customerEntityCollection)
            {
                MessageBox.Show(customerEntity.CustomerId);
            }

            dataAccessAdapter.CloseConnection();
            dataAccessAdapter.Dispose();

Error Message: "Unknown connection option in connection string: initial catalog."

Stack Trace: at System.Data.SqlServerCe.ConStringUtil.ParseStringIntoHashtable() at System.Data.SqlServerCe.ConStringUtil.ParseConnectionString() at System.Data.SqlServerCe.SqlCeConnection.set_ConnectionString() at System.Data.SqlServerCe.SqlCeConnection..ctor() at WM.BusinessObjects.DatabaseSpecific.DataAccessAdapter.CreateNewPhysicalConnection() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.GetActiveConnection() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateSelectDQ() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollectionInternal() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection() at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection() at WM.TimeTracker.MainForm.Setup() at WM.TimeTracker.MainForm.MainForm_Load() at System.Windows.Forms.Form.OnLoad() at System.Windows.Forms.Form._SetVisibleNotify() at System.Windows.Forms.Control.set_Visible() at System.Windows.Forms.Application.Run() at WM.TimeTracker.Program.Main()

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Sep-2008 05:15:10   

I'm afraid that the direct SQLServer connection with CF is not supported (http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8387&StartAtMessage=0&#46327)

But you still can connect via WebServices (http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8786)

David Elizondo | LLBLGen Support Team
Dusty
User
Posts: 24
Joined: 19-Feb-2008
# Posted on: 03-Sep-2008 16:34:02   

Well that's too bad.cry Guess I'll have to do things the "old fashioned way" because a web service is not an option.

Thanks.simple_smile