none
Password automatically cleared in connection string RRS feed

  • Question

  • Hi there

    Thanks so much for assisting!

    I have a really weird situation. I've created a Sql server compact db that syncs to a Sql Server db. At first I created the client db without a password, but have now added a password. I also added the password in my connection string. Now when I try to synchronize, I keep getting the error "The specified password does not match the database password."

    I tried everything, deprovisioned server and client, and even created the client db from scratch (with password). Then I debugged really thorougly and found the following weird occurrance. My SqlCeConnection connectionstring contains the ";Password=xxxx" clause, but exactly when I do a ScopeExists check on the SqlCeSyncScopeProvisioning, the password magically disappears. Haha this is so weird because I don't even touch the connection string.

    I'm going to do a workaround for now (maybe a try...catch iso ScopeExists) but will appreciate an answer on this.

    I'll put all my code here:

    App.config

    	<connectionStrings>
    		<add name="clientDb" connectionString="Data Source=c:\client.sdf; Password=password" providerName="Microsoft.SqlServerCe.Client.3.5" />
    

    SyncManager.cs:

                    

    SqlCeConnection clientConn = newSqlCeConnection(ConfigurationManager.ConnectionStrings["clientDb"].ConnectionString);

    ... (at this stage the connectionstring is still "Data Source=c:\client.sdf; Password=password")                 // Create a new sync scope descriptionDbSyncScopeDescription scopeSecurityDownloadDesc = newDbSyncScopeDescription(syncScopeName); ... (set up server provisioning)

    // Create sync scope on client db

                    SqlCeSyncScopeProvisioning clientProvision = newSqlCeSyncScopeProvisioning(clientConn, securityScopeDesc);                 if (!clientProvision.ScopeExists(syncScopeName))

    ... (this check is negative, but suddenly after doing this, the connectionstring changes to "Data Source=c:\client.sdf;"                 {                     clientProvision.SetCreateTableDefault(DbSyncCreationOption.Create);                     clientProvision.Apply();                 }                 SyncOrchestrator syncOrchestratorKuduwaveDownload = newSyncOrchestrator();                 syncOrchestratorKuduwaveDownload.LocalProvider = new SqlCeSyncProvider(syncScopeName, clientConn);

                                                                             

    Sunday, May 20, 2012 12:52 PM

All replies