PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...
If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.
"Untitled" by R [Plain Text]Actions: |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
using System;
using MySql.Data.MySqlClient;
class mysql
{
static void Main()
{
MySqlConnection conn;
string myConnectionString;
Console.WriteLine("Server: ");
string server = Console.ReadLine();
Console.WriteLine("Username: ");
string user = Console.ReadLine();
Console.WriteLine("Password: ");
string pass = Console.ReadLine();
Console.WriteLine("Database: ");
string db = Console.ReadLine();
myConnectionString = "server="+server+";user id="+user+"; pwd="+pass+";database="+db+";";
Console.WriteLine("Trying to connect...");
try
{
conn = new MySqlConnection();
conn.ConnectionString = myConnectionString;
conn.Open();
Console.WriteLine("Connected!");
Console.WriteLine("Press Enter to exit...");
Console.ReadLine();
}
catch (MySqlException ex)
{
System.Console.WriteLine("Error:\n\n" + ex.Message);
Console.WriteLine("Press Enter to exit...");
System.Console.ReadLine();
}
}
}
|