.net串連mysql資料庫語句,.netmysql資料庫

來源:互聯網
上載者:User

.net串連mysql資料庫語句,.netmysql資料庫

我的項目中將串連資料庫語句寫在設定檔中:

    <add key="ConnectionString" value="Database='testdata';Data Source='localhost';Port='3306';User Id='root';Password='root';Charset='utf8';TreatTinyAsBoolean=false"/>



其中database為資料庫名,Data Source為資料庫所在的伺服器位址,“localhost”代表本機地址,port為mysql資料庫的連接埠號碼 user id代表使用者名稱稱  password代表使用者密碼,charset表向伺服器請求串連所使用的字元集,預設:無  因為項目中的資料庫中存在中文,mysql不同的字元集對中英文的識別也不相同。採用utf8能保證不會出現中文亂碼的現象。



同時資料庫基字元集為“utf8”  ,資料庫定序為“utf8_general_ci”;


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.