Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. DataSet bdDataSet;
  2. MySqlConnection conexao;
  3.  
  4. public void inserir()
  5. {
  6. bdDataSet = new DataSet();
  7.  
  8. conexao = new MySqlConnection("Server=localhost; Database=teste; Uid=; Pwd=");
  9.  
  10. try
  11. {
  12. conexao.Open();
  13. Console.WriteLine("conectou");
  14. }catch{
  15. Console.WriteLine("Erro ao conectar");
  16. }
  17.  
  18. if(conexao.State == ConnectionState.Open ){
  19. Console.WriteLine("conexao aberta");
  20. MySqlCommand commS = new MySqlCommand("INSERT INTO usuario VALUES('teste', 'teste')", conexao);
  21. commS.BeginExecuteNonQuery();
  22.  
  23. }
  24.  
  25.  
  26. }
  27.  
  28. MySqlCommand commS = new MySqlCommand("INSERT INTO usuario VALUES('teste', 'teste')", conexao);
  29. commS.BeginExecuteNonQuery();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement