Simple Tabular Report Generation in WPF
This post is on using the power of the ReportViewer in WPF to build simple tabular reports on the fly. I did a presentation on this a while back and I noticed that there is some interest in building reports and having the ability to query your database on the fly without the need for SQL Server Management Studio or MS Access.
The sample included in this post is a simple mock up that can grow with time. It gives you the ability to connect to any SQL Server backend. You can then write your SQL in the editor. Finally, you can preview your data, make any changes you want to ensure that it is ready for a generating a report. You then click on the Generate Report button and the Preview Report tab becomes selected rendering a dynamic report based on your query. With very little code, you get a simple query editor, code generator, and local report viewer.
In this first post we will just take a look at the user interface but in a following post, we will cover the code necessary to get this working.
My example is using the AdventureWorks database but you can use whatever database you like. When the application first starts, are presented with the following window:
Click on the button as indicated in the following screen shot:
Follow the dialog and enter in your information for creating a connection.
You can test your connection and verify that it is correct.
Click the Connect button to create the connection. Type in the query you wish to perform:
You can now either execute the query or parse it. The following is a screen shot of the query executed:
As you can see, we get our results but we also get a grid in the middle that provides us with a bit of metadata for formatting our report. You can also provide a title for the report.
Then by clicking the Generate Report button, we see the following:
By now you can see that it is very easy to create some dynamic reports in very little time. In the next post we will go over the code and architecture required to get this to work. I have included the slides, source code, and a walk-through from my presentation.
Hope this helps….
Leave a reply to mardymonkeykier Cancel reply
Top Posts
- Aurelia and Pusher Collection
- JSON.parse and the reviver function
- Initial thoughts using Fastify
- Aurelia and Firebase Collection
- Build your own dashboard
- Building LOB applications in AngularJS
- TechTalent South - Presentation
- Upcoming Speaking Events
- .NET Uri, database not found, and encoding
- Chrome auto fills email and password
Tag Cloud
ASP.NET ASP.NET MVC ASP.NET Web API Behaviors BI book c# Caliburn.Micro Canvas Code Camp Code First Code Generation Compiler As A Service CSS CSS3 Dashboard Dashboards Databinding DataForm DataTemplate Debugging DomainDataSource DomainService Entity Framework Exception Handling Fluent NHibernate Game development Games Gofer HTML HTML5 HTTP HTTP Service HTTP Service API IIS JavaScript JSON Knockout.js LINQ Linq2Entities Linq2Sql MEF MVVM NHibernate Prism Razor REPL Reporting REST Roslyn Security Silverlight Speaking SQL SQL Server Templates Triggers Unity VB.NET Visual Studio Visual Studio 2012 WCF WCF RIA Services WCF Web API Web Web API Windows 8 Windows 8.1 Windows Phone 8 WinJS WinRT WP7 WPF Xaml XmlRecent Posts
Archives
- September 2019
- July 2019
- October 2014
- August 2014
- July 2014
- May 2014
- February 2014
- December 2013
- October 2013
- September 2013
- August 2013
- July 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- February 2011
- January 2011
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- November 2009
- October 2009
- August 2009
- July 2009
- February 2009
Thanks for posting
Hi Matt,
I was looking through the code and was just wondering if this relies on MS SQL or if I could use it with MySQL and the .NET connector?
I believe that the code currently uses a SQL data provider but you can modify the XML for the report definition to support OLEDB or some other provider.
Hope that helps,
Matt