Hello,,
I want to to check whether the Database is already exist in to the Specified Database server.. and also for table.. Is anybody knows the query for this?? i alreasy use the following query . but as the ExecuteNonQuery() only return the rows affeted by the Insert, Update and Delete query. Plz Help
query = "show tables from db_micro_structure;
com = new MySqlCommand(query, myConnection);
try
{
myConnection.Open();
MessageBox.Show(com.ExecuteNonQuery().ToString());
myConnection.Close();
}
catch
{
}
Loading

try abcPosted Dec 21, 2007, 12:31 AM
I am really thank ful for help me second time in query problem..
Jan MontanoPosted Dec 20, 2007, 9:11 PM
select * from information_schema.tables where table_name = tablename
In checking if your database exists... You have to catch it in your exception. Try to play around connecting with an existing database and a non-existing one. Then you'll get the exception it will throw if the database is non-existing.
I don't know if there's a better way to do database checking.