Search code examples
c#sqlvb.netwinformsenterprise-library

WinForms dynamically specifying and managing SQL connection string info


I have a requirement to allow the user specify, at time of first use, the connection string with which to connect to a database, and change it later on, in Windows client application. My current idea is to store the information in a text file which is checked each time user opens the application for use, and prompts user for update if information has been deleted or is invalid. I am not however confident that this is a secure approach to handling this issue and would appreciate other suggestions to help me better manage this.


Solution

  • I'd store them in the app.config, as is the usual practice. You can modify the settings in code easily. Here's how

    They should also probably be encrypted, which can also be done in the applicaiton's launch. You can encrypt/decrypt from code just as easily as you can modify the settings. Here's how.