locked
Password changes - CompactDB and Application Connection String RRS feed

  • Question

  • I am developing a project using a ADO.NET Syncronization Services using SQL Compact database in C#. I am rather new to the SQL Compact world. My company is mandating password changes every 60 days on the Compact database.

    While researching on how to change the password on the local database, I understand that I can use SqlCeEngine.Compact(<new connection string/password>) to change the database password. This is straight forward and simple.

     

    I assume that when I change the password on the Compact DB, that I will also need to update the application connection string to use the new password.

    My problem comes when I want to update the application’s connection string in the Settings.settings/app.config with the new password. I believe this is the conn string to be used since the LocalDataCache.sync always connects using the global::<projname>.Properties.Settings… path.

    I have read an article (http://msdn2.microsoft.com/en-us/magazine/cc163684.aspx) and found that the connection string in the Settings.settings/app config file is read only. I see the Settings.Designer file only has a get statement and not a set.

     

    What is the best approach to programmatically changing a compact db password and, MOST IMPORTANTLY, have the application also change its connection string. Does this require a new release? We are electing to keep the client’s db present, and not deploying db with new release. Sync Services will handle the table schema changes if any are present.
    • Moved by Max Wang_1983 Friday, April 22, 2011 8:04 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, April 11, 2008 2:28 PM

Answers

  •  

    Hi Jason,

     

    the sample only shows that you can get the pwd from the settings.cs, but even this is not a secure way to store/mantian db passwords, I would suggest your all would prompt users to enter the pwd , or get it from some a secure locations or an encrypted files.

     

    thanks

    Yunwen

    Sunday, April 13, 2008 11:47 PM
    Moderator

All replies

  •  

    I'm moving on to editing the Settings.cs file. I see that it's derrived from the Settings class.

    I see some good notes in this article but it's not exactly what I'm looking for:

    Customizing the connection string for TableAdapters

    https://blogs.msdn.com/smartclientdata/archive/2005/07/25/443034.aspx

     

    I wish I could override my Settings.Designer.cs connection string property in the Settings.cs class and add a set property. Currently it's erroring due to a duplicate property of the same name.

     

    I'm not there yet........

     

    Thanks, Jason

    Friday, April 11, 2008 6:18 PM
  •  

    Hi Jason,

     

    the sample only shows that you can get the pwd from the settings.cs, but even this is not a secure way to store/mantian db passwords, I would suggest your all would prompt users to enter the pwd , or get it from some a secure locations or an encrypted files.

     

    thanks

    Yunwen

    Sunday, April 13, 2008 11:47 PM
    Moderator