Posts Tagged ‘SQL’

Build Your Own Dashboard

October 27, 2012 Leave a comment

I had a great time presenting on Build Your Own Dashboards at the SQL Saturday #174 Charlotte BI Edition.  Thank you to everyone who came to my session and participated in my talk.

Here is a link to the sample dashboard site I presented on:


Be advised that this site and the sample code is only optimized for IE 9.  You need to provide CSS3 vendor specific entries for WebKit and Mozilla if you want this to work perfectly in Chrome, Safari, and Firefox.

Here are the slides and sample code:

Slides and Sample code

Thanks again for the opportunity…

Simple Tabular Report Generation in WPF

May 11, 2011 4 comments

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:

Setting up the Connection

Follow the dialog and enter in your information for creating a connection.

Dialog for creating a database connection.

You can test your connection and verify that it is correct.

Dialog for testing the connection.

Click the Connect button to create the connection. Type in the query you wish to perform:

Write in your SQL query.

You can now either execute the query or parse it. The following is a screen shot of the query executed:

Query and metadata results displayed.

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.

Metadata set for report generation.

Then by clicking the Generate Report button, we see the following:

Report rendered in the ReportViewer control.

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….

Posting source code on my blog

I had a request from a reader as to how they could post sample code in response to an article I had written. I thought this was an excellent question and it can be hard to find the right answer when all you want to do is post your question.

The following is a quick example of posting a code snippet for XAML which is actually XML. If you want to submit XAML in a post or comment then you must wrap it with the following tag:

XAML snippet

It will then look like this once rendered:

<TextBox Text="Hello World" />

There are many other language targets. I use these common ones:

• csharp
• vb
• sql
• xml

Refer to this link for other targets as well.

Hope that helps….

Categories: English Tags: , , , , , ,

Dynamic Dashboards in Silverlight 4

Here are the slides from the presentation I did at the Charlotte ALT.NET group.

Hope you enjoy.

Categories: English Tags: , , ,

Modifying a column with the Identity pattern is not supported.

In doing some testing today, I came across a wierd scenario with using WCF RIA Services on top of the Entity Framework. I was testing a Site table that had the following data definition:

	  SiteIdent int identity NOT NULL
	, SiteKey varchar(4) primary key NOT NULL
	, MinimumPasswordLength int NOT NULL
	, RequirePasswordAuthentication bit NOT NULL

When I tried to make a modification to an existing record, I received the message in the title of my post:

“Modifying a column with the Identity pattern is not supported.”

One thing to note, I saw several other posts stating that this works with Entity Framework outside of WCF RIA Services. I verified that the StoreGeneratedPattern was set to “Identity” but it did not help. I also saw an entry in the msdn forums talking about creating a custom attribute.

Because I have control of the database, I made the following change to the data model to correct the issue:

	  SiteIdent int identity primary key NOT NULL
	, SiteKey varchar(4) NOT NULL
	, MinimumPasswordLength int NOT NULL
	, RequirePasswordAuthentication bit NOT NULL
	[SiteKey] ASC

It is curious since I did not encounter this problem when I had previously used RIA Services on top of Linq2Sql. I am sure that there are several ways to resolve this issue but I wanted to show one way to getting past this issue.

Hope this helps….