代码之家  ›  专栏  ›  技术社区  ›  AJM

Reporting Services-动态设置数据源,可能通过ReportViewer

  •  0
  • AJM  · 技术社区  · 16 年前

    我有一些2005年的报告服务报告。

    理想情况下,我希望他们使用从配置文件传入的连接字符串,理想情况下通过ASP.NETs ReportViewer控件。

    3 回复  |  直到 16 年前
        1
  •  1
  •   Tim Cooper    13 年前

    你可以这样做:

    DataSourceCredentials cred = new DataSourceCredentials();
    cred.Name = 'credential_name';
    cred.UserId = 'user_id';
    cred.Password = 'password';
    
    
    ReportViewer1.ServerReport.SetDataSourceCredential(new DataSourceCredentials[] { cred });
    ReportViewer1.ServerReport.Refresh();
    
        2
  •  0
  •   AJM    16 年前

    可以使用基于表达式的连接字符串动态设置连接字符串等

    http://blogs.msdn.com/bwelcker/archive/2005/04/29/413343.aspx

    使用与下面相同的技术

    http://msdn.microsoft.com/en-us/library/ms156450.aspx (关于基于表达式的连接字符串的部分)

    但是,这有点过分,因为这意味着您不能在设计器中预览报表。

        3
  •  0
  •   Etch    13 年前

    这要求在SQLRS配置中设置execution帐户,并且该帐户必须对它要连接的数据库授予适当的权限。

    推荐文章