简体   繁体   中英

Error when connecting to MySQL database

I cannot understand what is going on I am so confused it says UNKNOWN DATABASE on the exception error. When I do change the database name to "dbmdgoserver" only, it connects. I mean both databases exist within my PHPMyAdmin i can't see why it cannot connect.

con.ConnectionString = String.Format("server=localhost;user=root;database=dbmdgoserver2")
    Try
        con.Open()
        MsgBox("SUCCESS")
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try

Try this please (remove the 'String.Format()' part):

con.ConnectionString = "server=localhost;user=root;database=dbmdgoserver2"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM