Running the code below:
DataSet bdDataSet;
MySqlConnection conexao;
public void inserir()
{
bdDataSet = new DataSet();
conexao = new MySqlConnection("Server=localhost; Database=teste; Uid=; Pwd=");
try
{
conexao.Open();
Console.WriteLine("conectou");
}catch{
Console.WriteLine("Erro ao conectar");
}
if(conexao.State == ConnectionState.Open ){
Console.WriteLine("conexao aberta");
MySqlCommand commS = new MySqlCommand("INSERT INTO usuario VALUES('teste', 'teste')", conexao);
commS.BeginExecuteNonQuery();
}
}
The registry is entered normally, the problem is that if after the excerpt:
MySqlCommand commS = new MySqlCommand("INSERT INTO usuario VALUES('teste', 'teste')", conexao);
commS.BeginExecuteNonQuery();
If I run conexao.Close()
to close the connection it does not execute the command, as if it did not give commit
in the query and insert
is not done, what can it be?