C# Modify Connection String that exists inside a library

Posted by LnDCobra on Stack Overflow See other posts from Stack Overflow or by LnDCobra
Published on 2010-04-07T13:45:44Z Indexed on 2010/04/07 14:13 UTC
Read the original article Hit count: 675

I have a Class Library, which inside just has a DataSet (MySQL connector) and a Connector class.

I use this class in multiple projects to connect to the database, and I always had the password embedded in the connection string but now I need to be able to modify this string(for security purposes) so I can have the user connect using their own account.

How can I modify this connection string.

I have tried the following

Properties.Settings.Default.DataBaseConnectionString = "String";

But it seems that the connection string is readonly becase it doesn't appear to have a setter value.

I also tried the following with no luck

Properties.Settings.Default.DatabaseConnectionString.Insert(
Properties.Settings.Default.DatabaseConnectionConnectionString.Length - 1,
            "Password=dbpassword;");

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf