I am trying to insert data into a SQL table but getting an error that I do not have the required number of columns, e.g. I only give it teamname and teamtag, when it also had ID in the SQL table. The ID auto increments though so I am not sure how to make this work, any help is appreciated.
private void btnAdd_Click(object sender, EventArgs e)
{
da.InsertCommand = new SqlCommand("INSERT INTO tblTeams VALUES(@TEAMNAME, @TEAMTAG)", cs);
da.InsertCommand.Parameters.Add("@TEAMNAME", SqlDbType.VarChar).Value = txtTeamName.Text;
da.InsertCommand.Parameters.Add("@TEAMTAG", SqlDbType.VarChar).Value = txtTeamTag.Text;
cs.Open();
da.InsertCommand.ExecuteNonQuery();
cs.Close();
}
Error:
Column name or number of supplied values does not match table definition.
Specify the columns you are populating.