I am using C# 5 on Windows in the Atom IDE with the script package. In order to connect to a PHPMyAdmin MySQL database server, I need the mysql.data
namespace, but without Visual Studio, I do not know how to include this assembly reference.
String server = "localhost";
String database = "connectcsharptomysql";
String uid = "username";
String password = "password";
String connectionString;
connectionString = "SERVER=" + server + ";" + "DATABASE=" +
database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";
MySqlConnection s = new MySqlConnection(connectionString);
I have viewed these posts but they all concern using Visual Studio or a problem with the connection itself.
I was not able to do it in Atom because even though I added the assembly I don't know how to reference it within the IDE. I used the command line instead:
Download the MySql.Data.dll and put it in the same directory as the c# file
Including the using
directive at the top of the file:
using MySql.Data.MySqlClient;
csc FILENAME.cs /r:MySql.Data.dll
start FILENAME.exe
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.