1

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.

Marvin
  • 853
  • 2
  • 14
  • 38

1 Answers1

0

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:

  1. Download the MySql.Data.dll and put it in the same directory as the c# file

  2. Including the using directive at the top of the file:

using MySql.Data.MySqlClient;
  1. Run in the command line after getting to the directory:

csc FILENAME.cs /r:MySql.Data.dll

  1. Run in the command line

start FILENAME.exe

Marvin
  • 853
  • 2
  • 14
  • 38