当前位置:Gxlcms > mysql > 从ConnectionStringSettings获得数据库连接。使程序与具体数据库

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

时间:2021-07-01 10:21:17 帮助过:21人阅读

//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();

人气教程排行