skip to Main Content

Checking in C# whether MySQL database exists

I'm writing a simple console application in C# using top-level statements, and I want to check at the beginning whethere there exists a database. Here's my code: using MySql.Data.MySqlClient; using (MySqlConnection connection = new MySqlConnection("Server=localhost;Uid=root;Pwd=password;")) { connection.Open(); if (CheckDatabaseExistence(connection)) Console.WriteLine("Database…

VIEW QUESTION
Back To Top
Search