This code worked for me:
public class MySqlConnect
{
public MySqlConnection conn;
public MySqlConnect()
{
conn = new MySqlConnection("server=localhost;user=root;database=kioskdb;port=3306;password=''");
}
}
public void ResetToken() {
MySqlConnect connectOb = new MySqlConnect();
try
{
connectOb.conn.Open();
MySqlScript script = new MySqlScript(connectOb.conn, "SET @num := 0;
UPDATE serving_table SET Id = @num := (@num + 1);
ALTER TABLE serving_table AUTO_INCREMENT = 1;");
script.Execute();
connectOb.conn.Close();
}
catch (Exception ex)
{
Debug.WriteLine("Multiplecommand: " + ex.Message);
}
Comments