I have a method Insert()
. Everything is working as expected except for the auto increment. Here's the code:
public void Insert(string m1,int y1,int new_count)
{
string query = "INSERT INTO page_counter (id,month,year,page_count) VALUES('','"+m1+"',"+y1+","+new_count+")";
//create command and assign the query and connection from the constructor
MySqlCommand cmd = new MySqlCommand(query, connection);
//Execute command
cmd.ExecuteNonQuery();
//close connection
this.CloseConnection();
}
My Id column is an auto-increment. So my question is how can the value be inserted in the database an continue the auto increment in the table for id?