2013-10-15 115 views
0

我想簡單地打印到我正在使用的SQL版本的網頁,這是從我的老師提供的代碼,我把我的服務器和數據庫,我不知道如何找到我的數據庫用戶名以及是否有密碼。MySQL:查找數據庫用戶名

// add here your connection details 
String connectionString = "SERVER=127.0.0.1; DATABASE=dblogin;" 
+ "UID=YOUR_DB_USERNAME; PASSWORD='';"; 
// create and open a connection to the database 
MySqlConnection connection = new MySqlConnection(connectionString); 
connection.Open(); 
// print the MySQL version in a console 
ReturnError.Text = ("MySQL version: " + connection.ServerVersion); 
// this line will prevent the console from closing immediately 
// to close the console just press any key 

回答