2021年4月8日 星期四

ASP.NET C# MariaDB 連結字串

web.config  加入下面內容

<connectionStrings>

<add name="connect string" connectionString="server=IP;user id=user name;password=Password;Persist Security Info=True;Database=DB name;" providerName="MySql.Data.MySqlClient"/>

</connectionStrings>


程式引用

using MySql.Data.MySqlClient;

........

MySqlConnectionStringBuilder sqlsb = new MySqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["connect string"].ConnectionString);

MySqlConnection MySqlConnection = new MySqlConnection(sqlsb.ConnectionString);

string sqlStatement = @"select * from test";

MySqlCommand MySqlCommand = new MySqlCommand(sqlStatement);

MySqlCommand.Connection = MySqlConnection;

MySqlConnection.Open();

沒有留言:

Aruba 5520 設定備份

先打開 TFTP Server 接著連線到設備,不用進入 System View 備份前先儲存設定,以免遺漏 <core-switch> save force 開始備份 <core-switch> backup startup-configuration ...