var connection = ConnectionFactory.GetConnection(
ConfigurationManager.ConnectionStrings["Test"]
.ConnectionString, DataBaseProvider);
这是我的app。config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="Test" connectionString="Data Source=.;Initial Catalog=OmidPayamak;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
但是当我的项目运行时,这是我的错误:
对象引用未设置为对象的实例。