Syntax error when adding a parameter with textBox1.Text.I want to add a column to the database. How do I do it right. Write the correct code please
private async void button1_Click(object sender, EventArgs e)
{
MySqlCommand command = new MySqlCommand("ALTER TABLE Students ADD COLUMN ? TEXT", sqlConnection);
command.Parameters.AddWithValue("?", textBox1.Text);
try
{
await command.ExecuteNonQueryAsync();
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Screenshot https://i.paste.pics/77ce28a6fd93598b0939bc43a1d15b9a.png
Screenshot 2 result answer https://i.paste.pics/a9e8c0739bcbaf6cf7a23ca62a9c9812.png
'?'a legal name for a column?