<!--webconfig-->
<connectionStrings>
<add name="ConnectionString" connectionString="server= server ip ; user=userid ;pwd=userpassword;database=dbname"/>
</connectionStrings>
using System.Configuration; //加這個 //WINFORM 需將System.Configuraction加入參考。
string strConn = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
=================== appSetting ===================================
<!--webconfig-->
<appSettings>
<add name="ConnectionString" connectionString="server= server ip ; user=userid ;pwd=userpassword;database=dbname"/>
</appSettings>
string strCon = ConfigurationManager.AppSettings["ConnectionString"];
沒有留言:
張貼留言