1. Option. Works. When adding records to the database with a prescribed list of variables in the code
Code
MySqlCommand sqlCom = new MySqlCommand ("INSERT INTO " + textBox51.Text + // ТАБЛИЦА "(" + textBox52.Text + // ПОЛЯ ") VALUES" + "('" + pol_2 + "', '" + pol_3 // работает + "')", connection); // РАБОТАЕТ. ПОДСТАВЛЯЕТСЯ значение из переменных sqlCom.ExecuteNonQuery(); } Option 2. Does not work. When adding records to the database with the prescribed list of variables in the textBox. In textBox I register - pol_2 + "','" + pol_3
Code
MySqlCommand sqlCom = new MySqlCommand ("INSERT INTO " + textBox51.Text + // ТАБЛИЦА "(" + textBox52.Text + // ПОЛЯ ") VALUES" + "('" + textBox57.Text // НЕ РАБОТАЕТ ХХХ + "')", connection); // РАБОТАЕТ. ПОДСТАВЛЯЕТСЯ значение из переменных sqlCom.ExecuteNonQuery(); } I attach a skin with an error message.
Question.
- Why does not work 2. Option?
- How to make a worker?
