I have a connection string as a varible "strConn". How would I save this to the config file so that my application would use the string to access the database using a button_click event to initialise it An example would be helpful.
Thanks
Spike
I have a connection string as a varible "strConn". How would I save this to the config file so that my application would use the string to access the database using a button_click event to initialise it An example would be helpful.
Thanks
Spike
Saving Connection Strings
mandoman
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
+ textBox2.Textwhich gives the elements for the string (povider etc) and attatches the path name of the database to the end (textbox2). The path for the textbox comes from a fileOpen dialog.
ie. I get:
Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\...\Database.mdb
Also, because of the user needing to select the path, saving the path to the config file needs to be in the code, not just a setting.
Yosi Taguri
If you don't use integrated security to access your data source, beware that any stored usernames and passwords are in plain text, so potentially could result in security problems