I am trying to connect MySql database but when executing the code it gives me this error:
Cannot print exception string because Exception.ToString() failed
using System;
using MySql.Data.MySqlClient;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string connStr = "server=localhost;user=root;database=people;password=slidan4eg";
MySqlConnection conn = new MySqlConnection(connStr);
conn.Open();
string sql = "SELECT name FROM men WHERE id = 2";
MySqlCommand command = new MySqlCommand(sql, conn);
string name = command.ExecuteScalar().ToString();
Console.WriteLine(name);
conn.Close();
}
}
}
UPD: I was try to debug this and debugger said programm is broken on conn.Open();, I thought it might be important
