首頁  >  文章  >  資料庫  >  从ConnectionStringSettings获得数据库连接。使程序与具体数据库

从ConnectionStringSettings获得数据库连接。使程序与具体数据库

WBOY
WBOY原創
2016-06-07 15:41:251414瀏覽

//using System.Data; //using System.Data.Common; ConnectionStringSettings aSett = System.Configuration.ConfigurationManager.ConnectionStrings["configedDB"]; DbProviderFactory aF = DbProviderFactories.GetFactory(aSett.ProviderName); DbConne

//using System.Data;
//using System.Data.Common;

 

 

ConnectionStringSettings  aSett = System.Configuration.ConfigurationManager.ConnectionStrings["configedDB"];
            DbProviderFactory aF = DbProviderFactories.GetFactory(aSett.ProviderName);
            DbConnection aconn = aF.CreateConnection();
            aconn.Open();

 

 

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn