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

后端 未结 1 1461
执笔经年
执笔经年 2021-01-23 04:52

I need to create a simple, stand-alone application that will allow for users to input some data and then print a report. I would prefer to use SSRS as a reporting engine but I

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-23 05:48

    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();
            }
        }
    
    }
    

    0 讨论(0)
提交回复
热议问题