At each Directory change, I store the filenames in a table.
Reset table and set AUTO_INCRTEMENT = 0
The first time the counter is = 0
id = 0
id = 1
id = 2
...
The following times I empty the table and set AUTO_INCREMENT = 0 the value of the first id is always = 3
id = 3
id = 4
id = 5
....
tb_temporary - InnoDb - utf8mb4 - utf8mb4_900_ai_ci
id = INT(11) - PK - NN - AI
What I have tried:
int Contatore = 0;
Query = "ALTER TABLE tb_temporary AUTO_INCREMENT = @contatore";
gesdb.AlterCounter(Query, conn, Contatore);
public void AlterCounter(string Query, MySqlConnection MyConn2, int contatore)
{
try
{
MyConn2 = Connection;
if (MyConn2.State != ConnectionState.Open)
{
MyConn2.Open();
}
MySqlCommand cmd = new MySqlCommand(Query, MyConn2);
cmd.Parameters.AddWithValue("@contatore", contatore);
try
{
cmd.ExecuteNonQuery();
}
catch
{
}
}
catch
{
}
}