var connectionString new MySqlConnectionStrin gBuilder Server localhos

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
var connectionString = new MySqlConnectionStringBuilder()
{
Server = "localhost",
Port = 3306,
Database = "lal",
UserID = "root",
Password = ""
};
var con = new MySqlConnection(connectionString.ConnectionString);
try
{
con.Open();
}
catch
{
System.Windows.Forms.MessageBox.Show("Невозможно подключиться к базе данных.");
Environment.Exit(0);
}