我正在尝试将我正在使用的 SQL 版本简单地打印到网页上,这是我老师提供的代码,我已经放入了我的服务器和数据库,我不知道如何找到我的数据库用户名,如果它有密码。
// 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