Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been searching diligently for a straight-forward way to handle a dynamic (runtime) connection to a sql database in Windows Forms application. I have found some far-out answers using COM and Interop that just seem antiquated.

Here is the requirement:

  • Upon first use of the Application, the user enters information into the form to connect directly to THEIR database.
  • The information is assimilated into a Connection String and Tested.
  • The user saves this information to be used everytime the Application runs.
  • The user has the ability to add more connections and modify the connections depending on the database they want to use.
  • The information is saved SOMEWHERE where it can only be accessed by the program.
  • The information is saved so the that the username and password are secure.


Just so its clear, I am an ASP.NET programmer. This is my first Forms application. I am aware of the App.config file (like web.config) but it is my understanding that this can not be changed once the application is built as it becomes wrapped in a dll file.

Where can I save my information so that I can keep it secure and the application can use it to connect to the sql server?
Posted
Updated 21-Jan-11 13:20pm
v3

You say you have been searching, so you may have seen The .NET Developer's Guide to Windows Security[^] already.

If not, it has some good ideas, well it has some good ideas even if you have seen it :) .
 
Share this answer
 
Wrong. The app.config file doesnt' get wrapped in anything. It sits in the same directory as the .EXE your made, with the same name as the .EXE, just with .config appended to it. For example, if your app compiles to MyApp.exe, the config file would be MyApp.exe.config.

It's a normal XML file, just like any other. You can edit it any time you want.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900