I am attempting to set up a method to check if a database exists, and return true/false.
Is it possible to do this with MySQL? Or would it be better off using a method in c#?
What I have so far:
public bool TestDbConnection()
{
try
{
mySqlConnect = new MySqlConnection(mySqlConnectionString);
mySqlConnect.Open();
// Check if <database_name> exists
if (<database_name>.Exists)
{
return true;
}
else { return false; }
}
catch (MySQLException e) { }
if (mySqlConnect != null)
{
mySqlConnect.Close();
}
}