革博士程序V1仓库
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

README.md 2.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ## About
  2. MySQL provides connectivity for client applications developed in .NET compatible programming languages with MySQL Connector/NET through a series of packages.
  3. MySql.Data is the core package of Connector/NET. It is compatible with .NET Framework 4.6+ and .NET 6.0+ and provides classic MySQL protocol and MySQL X DevAPI capabilities.
  4. More information at [MySQL Connector/NET documentation](https://dev.mysql.com/doc/connector-net/en/).
  5. ## How to use
  6. ```
  7. MySql.Data.MySqlClient.MySqlConnection myConnection;
  8. string myConnectionString;
  9. //set the correct values for your server, user, password and database name
  10. myConnectionString = "server=127.0.0.1;uid=root;pwd=12345;database=test";
  11. try
  12. {
  13. myConnection = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
  14. //open a connection
  15. myConnection.Open();
  16. // create a MySQL command and set the SQL statement with parameters
  17. MySqlCommand myCommand = new MySqlCommand();
  18. myCommand.Connection = myConnection;
  19. myCommand.CommandText = @"SELECT * FROM clients WHERE client_id = @clientId;";
  20. myCommand.Parameters.AddWithValue("@clientId", clientId);
  21. // execute the command and read the results
  22. using var myReader = myCommand.ExecuteReader()
  23. {
  24. while (myReader.Read())
  25. {
  26. var id = myReader.GetInt32("client_id");
  27. var name = myReader.GetString("client_name");
  28. // ...
  29. }
  30. }
  31. myConnection.Close();
  32. }
  33. catch (MySql.Data.MySqlClient.MySqlException ex)
  34. {
  35. MessageBox.Show(ex.Message);
  36. }
  37. ```
  38. ## Related Packages
  39. * Entity Framework Core: [MySql.EntityFrameworkCore](https://www.nuget.org/packages/MySql.EntityFrameworkCore/)
  40. * Entity Framework: [MySql.Data.EntityFramework](https://www.nuget.org/packages/MySql.Data.EntityFramework)
  41. * Web: [MySql.Web](https://www.nuget.org/packages/MySql.Web)
  42. * OpenTelemetry: [MySql.Data.OpenTelemetry](https://www.nuget.org/packages/MySql.Data.OpenTelemetry)
  43. ## Contributing
  44. There are a few ways to contribute to the Connector/NET code. Please refer to the [contributing guidelines](https://github.com/mysql/mysql-connector-net/blob/8.x/CONTRIBUTING.md) for additional information.
  45. ### Additional Resources
  46. * [MySQL](http://www.mysql.com/)
  47. * [MySQL Connector/NET GitHub](https://github.com/mysql/mysql-connector-net)
  48. * [MySQL Connector/NET API](https://dev.mysql.com/doc/dev/connector-net/latest/)
  49. * [MySQL Connector/NET Discussion Forum](https://forums.mysql.com/list.php?38)
  50. * [MySQL Public Bug Tracker](https://bugs.mysql.com)
  51. * [`#connectors` channel in MySQL Community Slack](https://mysqlcommunity.slack.com/messages/connectors) ([Sign-up](https://lefred.be/mysql-community-on-slack/) required when not using an Oracle account)
  52. * For more information about this and other MySQL products, please visit [MySQL Contact & Questions](http://www.mysql.com/about/contact/).