SQL Server Compact Edition and reporting. Is SSRS an option?

无人久伴 提交于 2019-12-01 23:43:46

You can use the standalone Reporting Services ReportViewer control with a DataSet from a SQL Server Compact database file, that runs completely locally and does not require any SQL Server installtion.

I do that in my SQL Server Compact Toolbox, with code similar to this (full source available at http://sqlcetoolbox.codeplex.com ) :

public partial class ReportGrid : UserControl
{
    public ReportGrid()
    {
        InitializeComponent();
    }

    public DataSet DataSet { get; set; }

    public string TableName { get; set; }

    private void ReportGrid_Load(object sender, EventArgs e)
    {
        if (DataSet != null)
        {
            DataSet.DataSetName = TableName;

            Stream rdlc = RdlcHelper.BuildRDLCStream(
                DataSet, TableName);

            reportView.LocalReport.LoadReportDefinition(rdlc);
            reportView.LocalReport.DataSources.Clear();
            reportView.LocalReport.DataSources.Add(
                new ReportDataSource(DataSet.DataSetName, DataSet.Tables[0]));
            reportView.RefreshReport();
        }
    }

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!