I strongly suspect since you used qqq
and xyz
without single quotes, OleDbCommand
see them as a parameter. That's why it expects some parameter values for both.
Because if they were strings, they would be used with single quotes like;
INSERT INTO Customers (CustomerID, CompanyName) VALUES ('qqq', 'xyz')
If they are some variables, and want to add them to your command, you should always use parameterized queries to prevent SQL Injection attacks.
using(OleDbConnection connection = new OleDbConnection(conString))
using(OleDbCommand command = _connection.CreateCommand())
{
command.CommandText = "INSERT INTO Customers(CustomerID, CompanyName) VALUES(?, ?)";
command.Parameters.Add("@p1", OleDbType.VarChar).Value = qqq;
command.Parameters.Add("@p2", OleDbType.VarChar).Value = xyz;
connection.Open();
command.ExecuteNonQuery();
}
And CustomerID
is a very bad name for a character column because as a general ID
part used for numerical values.