1
When executing 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 record is entered normally, the problem is that if after the excerpt:
MySqlCommand commS = new MySqlCommand("INSERT INTO usuario VALUES('teste', 'teste')", conexao);
commS.BeginExecuteNonQuery();
In case I run conexao.Close()
to close the connection it does not execute the command, as if it did not give the commit
in the query and the insert
is not done, what can be?
Mysql supports asynchronous events, as I searched about a month ago and had no evidence of support...
– Bruno Casali