这更多的是一种通用的问题,我建立一个报告生成:SQL连接字符串提供程序名称
public ReportGenerator(IReportGeneratorConfig config)
{
Configuration = config;
ImagePaths = new Dictionary<string, string>();
ReportErrors = new StringBuilder();
DatabaseForReportQueries = DatabaseFactory.CreateDatabase(Configuration.DatabaseName);
using (System.Data.Common.DbConnection conn = DatabaseForReportQueries.CreateConnection())
{
//get the connection string for use with the report directly.
ReportConnectionString = conn.ConnectionString + "Provider=SQLOLEDB;";
conn.Close();
}
}
这是试图运行报告生成按钮
当我收到错误消息Cannot open data source, please check ConnectionString and RecordSource properties.
ConnectionString: Database=Test80;Server=SQL01;uid=mcadmin;pwd=password;Provider=SQLOLEDB;
RecordSource:
除了我在代码中发送的提供程序之外,所有信息都是完整的。我不知道如何在网络应用程序中找到提供者名称。这与connectionStrings.config
中的providerName
标记不同。它需要Provider=something;
连接字符串有providerName = System.Data.SqlClient