none
Connect to the database with combobox RRS feed

  • Question

  • Hello

    I am looking for a solution to a problem that I could not find on the forums.
    My connection to a database was:

    MySqlConnection con = new MySqlConnection("server=localhost;user id=root;Password=root;database=ilerose");
            MySqlCommand command;
            DataTable dt;
            MySqlDataAdapter SDA;

    But the problem is this: I want to allow the user to select the name of the database in a comboBox like this:

    MySqlConnection con = new MySqlConnection("server=localhost;user id=root;Password=root;database='"+comboBox.Text+"'");
            MySqlCommand command;
            DataTable dt;
            MySqlDataAdapter SDA;
    Unfortunately, my last connection to the database does not work.
    I beg you to offer me a solution
    thank you

    Monday, August 12, 2019 12:46 PM

Answers