這更多的是一種通用的問題,我建立一個報告生成: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