none
Can .Net application or alternatives to search for database in MySQL RRS feed

  • Question

  • Hi,

     

    Im trying to do a setup MySQL application,

    whereby

    1) I need to 'query' and check if 'database name' given is exist.

    if not exist, i need to 'Create Database'

    2) Then use Database and Create Tables (Can be done).

     

    Im stuck at 1), how can I go about doing so?

     

    Thanks

    Elvin

    Friday, November 7, 2008 6:19 AM

All replies

  • You could just trap the error (in your Try...Catch block) that occurs when you execute the Open command for your Connection object.
    Friday, November 7, 2008 2:19 PM
  • any idea what is the query to 'check database name exist' ?

    i only use database and show database..

    Monday, November 10, 2008 3:49 AM
  • In SQL Server there is an SMO .NET API that allows to get information about available objects on a database server. If MySQL provides similar API, then that is what you need to use, otherwise .NET has nothing built-in to support this functionality. as Paul mentioned you could try to trap errors.

     

    Monday, November 10, 2008 11:42 AM
    Moderator