Kemal Bekirov

Kemal Bekirov

  • NA
  • 202
  • 745

Hello! I need help!

Dec 5 2023 2:20 PM

I have a bug in this method. "INSERT INTO syntax error"

I don't know how to fix it. help me please

public void Add(string MName, string Color, int Cost)
{
    connection.Open(); 
    command = new OleDbCommand("INSERT INTO Catalog (MName, Color, Cost) VALUES (@MName, @Color, @Cost)", connection);
    command.Parameters.AddWithValue("@MName", MName);
    command.Parameters.AddWithValue("@Color", Color);
    command.Parameters.AddWithValue("@Cost", Cost);
    command.ExecuteNonQuery();
    connection.Close();
}
 


Answers (2)