Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. using System;
  2. using System.Data;
  3. using MySql.Data;
  4. using MySql.Data.MySqlClient;
  5. public class Tutorial1
  6. {
  7. public static void Main()
  8. {
  9. string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
  10. MySqlConnection conn = new MySqlConnection(connStr);
  11. try
  12. {
  13. Console.WriteLine("Connecting to MySQL...");
  14. conn.Open();
  15. // Perform database operations
  16. }
  17. catch (Exception ex)
  18. {
  19. Console.WriteLine(ex.ToString());
  20. }
  21. conn.Close();
  22. Console.WriteLine("Done.");
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement