what my code is supposed to do is add new rows with new drills to a datagridview, my problem is whenever i add a new row to my datagridview this creates a new id at the top of the datagridview with the wrong number, im using the following code to add new rows.
private void button5_Click(object sender, EventArgs e)
{
string strcon = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Directory.GetCurrentDirectory() + @"\database\DatabaseENG.accdb"; // String de Conexão com a Database
string comando = @"INSERT INTO [Norms Table]
([Drills (according to the norm EN 61439-2)])
values
(@drills)"; // Query de Inserção de Normas
//Representa uma conexão aberta a uma Datasource
using (OleDbConnection con = new OleDbConnection(strcon))
{
using (OleDbCommand com = new OleDbCommand(comando, con))
{
// Igualar valor dos parametro a textbox
com.Parameters.Add("@drills", OleDbType.VarChar).Value = textBox5.Text;
//try and catch para efetuar a conexão com a database
try
{
con.Open();
com.ExecuteNonQuery();
MessageBox.Show("Save Well Succeded !");
norms_TableDataGridView.Refresh();
button9_Click(sender, e);
}
catch (Exception E)
{
MessageBox.Show(E.Message);
}
}
}
}
if you need any extra code to understand please let me know, thanks for any help in advance, the following image is an example of what is happening.