Connection string for MYSQL



using MySql.Data.MySqlClient;

 public MySqlActivity(string DatabaseName)
            {
                ConnectionString = "Data Source=localhost;Database=" + DatabaseName + ";    UserId=root;Password=; charset='utf8'";
            }

            public MySqlActivity(string DatabaseServer, string DatabaseName)
            {
                ConnectionString = "Data Source=" + DatabaseServer + ";Database=" + DatabaseName + "; UserId=root;Password=";
            }

            public MySqlActivity(string DatabaseServer, string DatabaseName, string UserId, string Password)
            {
                ConnectionString = "Data Source=" + DatabaseServer + ";Database=" + DatabaseName + "; UserId=" + UserId + ";Password=" + Password + "";
            }

No comments: