首页  >  文章  >  数据库  >  从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