Monthly Archives: February 2014

SSRS 2008: Reporting Services and SharePoint

SQL Server 2008 Reporting Services supports two different installation options:

  • Native mode. The Report Server controls all report execution, rendering, and management.
  • SharePoint integrated mode. Report Server runs as part of a SharePoint server farm. SharePoint provides front-end access to content, management, and security. The Report Server takes care of report execution and rendering.

In order to use SharePoint integrated mode, you must have installed Windows SharePoint Services 3.0 or Office SharePoint Server 2007. You also need to configure Report Server for SharePoint integrated mode.

TIP:An alternative to deploying Reporting Services in SharePoint Integrated mode is to deploy Reporting Services in Native mode, but to use the Reporting Services Web parts to find and view reports from SharePoint.

Why Use SharePoint Integrated Mode?

SharePoint Integrated mode makes the most sense when your organization has made a strong investment in SharePoint and you want to leverage that investment when creating, executing, and managing reports.

A number of Reporting Services features are only available when working in SharePoint Integrated mode. When in integrated mode, you can:

  • Manage reports, data sources, and report history using SharePoint.
  • Use the document management and collaboration features of SharePoint with reports.
  • Make use of SharePoint managed authentication and authorization for reports. This includes the use of Forms authentication.
  • Distribute reports outside of a firewall using SharePoint.
  • Deliver reports using a SharePoint delivery extension.
  • Create custom integrations between a SharePoint site and Reporting Services using the ReportingServices Web services API.

A number of Reporting Services features are not supported when the Report Server is configured for Integrated mode. These include:

  • Report Manager
  • My reports
  • Linked reports
  • The rs.exe command-line utility

NOTE While there is much in common across Native and Integrated modes, where there is a difference, this course will cover the Native mode approach.

TIP: See SQL Server 2008 Books Online and your SharePoint documentation for guidance on SharePoint-specific features and interfaces.

paul_LitwinPaul Litwin is a developer specializing in ASP, ASP.NET, Visual Basic, C#, SQL Server, and related technologies. He is an experienced trainer, has written articles for MSDN Magazine and PC World, and is the author of several books including ASP.NET for Developers (SAMS) and Access 2002 Enterprise Developer’s Handbook (SYBEX). Paul is a Microsoft MVP, the chair of the Microsoft ASP.NET Connections conference, and a member of the INETA Speakers Bureau.

Windows Presentation Foundation Using Visual C# 2010: Introducing Binding

As you write applications, you often need to update the value of one element with information from another element. Often, you need to display information coming from a collection of objects in a list, or combo box. Or, perhaps you need to work with data coming from a data source, such as a database. In all these cases, the simplest solution is to bind data from a data source to a target element; in other words, you need binding capabilities.

Data binding makes it simple for applications to display and interact with data. You use a connection, or binding, between the data source and the target; this binding object allows data to flow between the source and the target objects. Once you have created a binding, and you change data in the data source, the changes appear in the target. If you have enabled two-way data binding, you can also make changes in the target and have those changes appear back in the original data source.

When might you use binding? You might use binding to:

  • Display the number of characters in a text box, in a TextBlock control.
  • Display the value of a Slider control in a TextBlock control.
  • Display a list of customers in a ListBox control.
  • Display a customer’s photo in an Image control.
  • Display and edit a customer’s name in a TextBox control.

Obviously, there are infinite reasons to use binding, and XAML makes it easy.

Connecting Sources and Targets

Every time you use binding, you must supply a source for the data, and a target (normally, a dependency property of some user interface element). Figure 1 demonstrates the basic concepts of binding in XAML. As you can see, the binding source can be any property of any CLR object. The binding object connects this source to the binding target, which must be a dependency property of some object that inherits from FrameworkElement (all the standard
controls inherit from this base class, and just about every property of these controls is a DependencyProperty object.)


Figure 1. The Binding object connects the binding source and target.

Although you can generally work blissfully unaware of this fact, when you use a binding in XAML you’re actually creating an instance of the Binding class, setting various properties. XAML provides a markup extension that hides this fact, as you’ll see, but all the same, you’re working with a Binding class instance.

TIP: If you want to create a binding in code, you’ll always need to create an
instance of the Binding class, and set its various properties to match the
properties you would otherwise set in XAML markup.

The flow shown in Figure 1 indicates that binding can work in multiple directions. By setting the Mode property of the Binding instance, you can indicate whether you want the data to move in one direction whenever changes are made to the source, in one direction only once, in two directions, or not at all.

Value Converters

The Value Converter block in Figure 1 represents an instance of a class that implements the System.Windows.Data.IValueConverter interface. You’ll often need to use a value converter, especially if you want to do all of your binding declaratively, in the XAML markup. Imagine scenarios like these, in which value converters become necessary:

  •  You want to select a customer from a ListBox, and display the combined FirstName and LastName fields in a TextBlock.
  •  You want to select a number value, and use that value to set the BorderThickness of a Border control. You can’t simply bind the number to the property, because the BorderThickness property of a Border is a Thickness object.

There are, obviously, infinite reasons to use a value converter, but unless you perform data binding declaratively (in the XAML markup, that is) there’s no reason to use one. But if you would like to simplify your applications and reduce the amount of code you must maintain, using declarative binding is a truly useful tool, and it requires value converters in order to be fully useful.

This post is an excerpt from the online courseware Presentation Foundation Using Visual C# 2010 course written by expert Ken Getz and Robert Green.

Ken Getz is a Visual Studio expert with over 25 years of experience as a successful developer and consultant. He is a nationally recognized author and speaker, as well as a featured instructor for LearnNowOnline.

  Robert Greenis is a Visual Studio expert and a featured instructor for several of our Visual Basic and Visual C# courses. He is currently a Technical Evangelist in the Developer Platform and Evangelism (DPE) group at Microsoft. He has also worked for Microsoft on the Developer Tools marketing team and as Community Lead on the Visual Basic team. Robert also has several years of consulting experience focused on developer training, and is a frequent speaker at technology conferences including TechEd, VSLive, VSConnections and Advisor Live.

SQL Server 2008: The BIDS Interface and Components

SQL Server Integration Services is not the only member of the Microsoft Business Intelligence suite to use BIDS for development. Analysis Services and Reporting Services developers also use BIDS to create their work. Using project templates supplied by Microsoft, Analysis Services developers build cubes, data mining models, and other analytical objects, while report developers build reports and report models in BIDS.

BIDS supports any or all of these project types within the same solution, as
shown in Figure A.


Figure A. The BIDS Solution Explorer window showing multiple SQL Business Intelligence project types.

TIP: You can create as many Integration Services packages as you want in a single solution. Modularizing a complex ETL workflow into multiple packages makes it easier to develop and debug the individual components. When all the packages are working correctly, you can group them to execute all at once using an Execute Package task.

Creating a new Integration Services project—rather than just opening a package as a standalone file—exposes some additional sections of the interface, such as access to the Data Sources and Data Source Views folders in Solution Explorer, as you can see in the Integration Services Project in Figure A.

Items that you add to a Project are visible in the Solution Explorer window, and can be accessible to any part of the project.

  • Data Sources contain a connection string, and are available in Solution Explorer in the Data Sources folder. They are created and maintained at the project level, outside of any package definition, but can be referenced by a package’s Connection Manager. Connection Managers depend on Data Sources in Integration Services and can be used to share connection definitions among multiple packages in the same solution.

TIP: When you use Data Sources, you can change the data connection strings for multiple packages at once. Adding Connection Managers directly to a package creates local data links, which you must edit per package.

  • Data Source Views are based on Data Sources, but support further filtering of the database schema. By creating package objects based on Data Source Views, you streamline working with lists of database objects.
  • The Miscellaneous folder can contain any support files you need, such
    as documentation, flat files that contain data for import, etc.

You access Integration Services functions in BIDS or Visual Studio through the SSIS menu, the tabbed designer windows, and their related toolboxes:

  • SSIS Menu: Choose options for setting up package logging, configurations, variables, and other options, as shown in Figure B.


Figure 2. The SSIS menu.

  • Tabbed Designer: Lay out the logic of the package by dragging tasks from the toolbox to the designer to control the overall flow of processing steps. For example, you could download files via FTP before importing them into a database table.
  • Toolboxes: The toolboxes associated with some of the designer tabs let you drag and drop components that perform the many potential actions of a complete Integration Services solution. If you are familiar with Web or Windows forms development in .NET, you’ll be right at home with adding components to a package.

In this course, you will learn about the BIDS tools that enable you to build powerful ETL solutions in Integration Services. The major components of the BIDS interface include:

  • Control Flow designer
  • Data Flow designer
  • Connection Managers
  • Event Handler designer
  • Package Explorer
  • Progress pane


This post is an excerpt from the online courseware for our Microsoft SQL Server 2008 Integration Services course written by expert Don Kiely. 

Don Kiely is a featured instructor on many of our SQL Server and Visual Studio courses. He is a nationally recognized author, instructor and consultant who travels the country sharing his expertise in SQL Server and security.

Visual C#: Navigation in Applications

In most client applications, users can have any number of windows open at the same time. In Outlook, you can have the Inbox, Calendar, Tasks, and Contacts open at the same time. You can have multiple messages, appointments, tasks and contacts open at the same time. You are limited solely by your tolerance for navigating amongst large numbers of windows.

When you create a Windows Forms Application project in Visual Studio, the first thing you see is a form. Often this will be your startup form. You then add any number of forms to the application. Each form is a window and it serves a purpose, whether it is data entry or reporting or a splash screen or navigation. Whether users navigate by selecting a menu item or clicking a button, the application displays a new form in a new window. Web applications take the opposite approach. Typically, you will have one window open, and that is the browser. As you navigate within a site, you load a different page in the browser and you have one page open at a time. This is not always the case, but it is true much more often than not.

In a WPF application, you can choose either of these navigation paradigms. The WindowNavigationDemo sample application consists of three windows. The MainWindow.xaml file defines the application’s startup window. It contains buttons to display the other two windows, defined in Window1.xaml and Window2.xaml. Both of these windows can be open at the same time, as
shown in the figure below.


Figure above, this application uses window-based navigation.

When you create an application based on the WPF Application project template, Visual Studio assumes that you will use windows-based navigation. It sets the startup window to MainWindow.xaml.

If you want to use page-based navigation, and make your application look and feel more like a Web application, you need to use pages rather than windows. You should also consider using hyperlinks rather than buttons.

The Page class is similar to the Window class. Each is a container and can contain a single element, such as a StackPanel, DockPanel, or Grid. A primary difference between a window and a page is that a page is designed to be navigated to.

A page can be hosted in a Window, a NavigationWindow, a Frame, another page, or the browser. Because it is not a standalone container, it has a smaller set of properties than a window.

The Page class contains several properties, including the following:

  • Background: Determines the background for the page
  • Foreground: Determines the default foreground for the page. All elements in the page will have this foreground by default.
  • FontFamily and FontSize: Determine the default font family and size for the page. All elements in the page will have this font size and family by default.
  • ShowsNavigationUI: Determines whether the page displays back and forward buttons.
  • Title: Sets the name of the page used in the navigation history.
  • WindowHeight and WindowWidth: Determine the height and widthof the window that hosts the page.
  • WindowTitle: Determines the title of the window that hosts the page.

The NavigationWindow class represents a window with built-in navigation support. This class derives from the Window class and includes the ability to display content and navigate. The content can be any .NET Framework object or HTML page, but typically the content will be in a page.

The NavigationWindow object supports not only navigation but the navigation history. Some of the properties of the NavigationWindow class are:
BackStack and ForwardStack: Return an IEnumerable you can use to enumerate the entries in the window’s back and forward navigation history.

  • CanGoBack and CanGoForward: Indicate whether there is at least one entry in the back and forward navigation history.
  • CurrentSource: Gets the uniform resource identifier (URI) of the content that was last navigated to.
  • ShowNavigationUI: Determines whether a NavigationWindow shows its navigation buttons.
  • Source: Gets or sets the uniform resource identifier (URI) of the current content, or the URI of new content that is currently being navigated to.

This post is an excerpt from the online courseware Presentation Foundation Using Visual C# 2010 course written by expert Ken Getz and Robert Green.

Ken Getz is a Visual Studio expert with over 25 years of experience as a successful developer and consultant. He is a nationally recognized author and speaker, as well as a featured instructor for LearnNowOnline.

Robert Green is a Visual Studio expert and a featured instructor for several of our Visual Basic and Visual C# courses. He is currently a Technical Evangelist in the Developer Platform and Evangelism (DPE) group at Microsoft. He has also worked for Microsoft on the Developer Tools marketing team and as Community Lead on the Visual Basic team. Robert also has several years of consulting experience focused on developer training, and is a frequent speaker at technology conferences including TechEd, VSLive, VSConnections and Advisor Live.

SharePoint 2010: Master Pages in SharePoint 2010

An installation of SharePoint 2010 contains many master pages. There are master pages that preserve backward compatibility for sites migrated from WSS 3.0 or MOSS 2007 including the old master page for Team sites, default.master, and master pages for application pages including simple.master and application.master.

There are also new master pages that support the new look and feel of SharePoint 2010. These are the v4 master pages and generally speaking, there is a v4 master page that corresponds to the old master pages. For example, v4.master is the replacement for default.master and simplev4.master is the replacement for simple.master.

Master Page Locations

You can find SharePoint’s various master pages in a few different locations depending on the master page and the context of its use. Within a SharePoint site, master pages are in a document library called the Master Page Gallery. The URL for this library relative to the Web’s URL is _catalogs/masterpage.

When you create a site, SharePoint provisions the appropriate master pages from the SharePoint root to the Master Page Gallery. The stock master pages that deploy to the Master Page Gallery from the SharePoint root are in Template\Global. However, there are additional master pages that support various application and administration pages that never deploy to a site located in Template\Layouts and in Template\Admin.

Often you can find additional custom master pages in the SharePoint root as part of features that deploy master pages via a Module feature element or as part of a custom site template.

Associating Master Pages with Content Pages

You can associate a master page with a content page in several ways. Some of these are dynamic and resolve at runtime to the SPWeb’s MasterUrl or CustomMasterUrl property, while others are static.

To create a dynamic association, use one of the following tokens as the value of the MasterPageFile attribute in the Page directive.

  •  ~masterurl/default.master
  •  ~masterurl/custom.master

Figure below shows the ~masterurl/default.master token in action in SharePoint
Designer. In this case it resolves to /_catalogs/masterpage/v4.master, but you
could change the SPWeb.MasterUrl property; the master page would change
without modifying the content pages.


Alternatively, you can specify the exact master page you want your content page to use with one of the static tokens.

  •  ~site/ActualFileName.master
  •  ~sitecollection/ActualFileName.master

The page parsers interpret both sets of tokens at runtime, but it is also possible to control the selection of a master page dynamically with .NET code in a page’s OnPreInit method or by using an HttpModule.

doug (frame 367 of smile clip)This post is an excerpt from the online courseware for our Microsoft SharePoint 2010 for Developers course written by expert Doug Ware.

Doug Ware is a SharePoint expert and an instructor for many of our SharePoint 2007 and SharePoint 2010 courses. A Microsoft MVP several times over, Doug is the leader of the Atlanta .NET User Group, one of the largest user groups in the Southeast U.S., and is a frequent speaker at code camps and other events. In addition to teaching and writing about SharePoint, Doug stays active as a consultant and has helped numerous organizations implement and customize SharePoint.

Microsoft SQL 2012 Developer: Creating Partitioned Tables

SQL Server 2012 includes the T-SQL extensions to allow for partitioned tables and indexes. Here are the specific steps you perform to create and maintain these database objects.

To create a partitioned table, complete the following tasks:

  1. Select an appropriate partition key.
  2. Create a partition function.
  3. Create a partition scheme.
  4. Create the table and identify its partition scheme.
Key Terms
Partition key A single column in a table whose values determine the partition on which the data resides.
Partition function A function that specifies how to partition the table by defining partition key boundaries for each subset of data.
Partition scheme A mapping of individual partitions to filegroups.

Creating a Partition Function

With a partition key selected, the next step is to define the partitions. The CREATE PARTITION FUNCTION statement specifies how to divide the table by identifying specific boundaries for each partition. The basic syntax of the CREATE PARTITION FUNCTION statement is:

Note: the following syntax details: The input_parameter_type specifies the data type of the partition key and not the name of the partitioning column. The LEFT and RIGHT keywords specify the side of a partition boundary on which a boundary_value belongs. LEFT is the default if you do not explicitly state a side.

LEFT and RIGHT Boundaries

The best way to understand the difference between LEFT and RIGHT partition boundaries is to look at some examples. Consider the following two partition functions:


Table below shows the specific partition boundaries for both LEFT and RIGHT versions of the partition function.

Partition Column Values (LEFT) Column Values (RIGHT)
1 <= 100 < 100
2 > 100 AND <= 1,000 >= 100 AND < 1,000
3 > 1,000 AND <= 10,000 >= 1,000 AND < 10,000
4 > 10,000 AND <= 100,000 >= 10,000 AND < 100,000
5 > 100,000 >= 100,000

The table above Partition range values defined according to LEFT and RIGHT boundaries.

A partition function that you define using LEFT boundaries indicates that the boundary value exists in the partition to the value’s left. Similarly, RIGHT boundaries place values in the partition to the value’s right.

Because all partition key values need to map to a partition, SQL Server actually creates n+1 partitions for every partition function. Notice that both functions specify only four boundary values. However, values less than the minimum and greater than the maximum are part of the entire domain of values and therefore must map to a partition.

TIP: If you need to specify acceptable minimum or maximum values, apply a CHECK constraint on the table to reject inappropriate partition key values. For example, to prevent partition key values greater than 100,000, define the partition function by using RANGE LEFT and placing a CHECK constraint on the table to reject values greater than 100,000.

In addition, a CHECK constraint on the table effectively leaves either the leftmost or the rightmost partition empty—a benefit if you add or remove partitions later.

Although not ideal, SQL Server allows partition key columns to contain NULL values and handles them using these rules:

By default, all records that have a partition key value of NULL exist on the leftmost partition.
If a partition function contains a NULL boundary value and is defined using RANGE RIGHT, the leftmost partition remains empty and rows that contain NULL values exist on the next partition.

Keep these considerations in mind when you design partition functions.

Frank TillinghastFrank Tillinghast is a senior consultant with MTOW Software Solutions. He is a Microsoft Certified Solution Developer and has been developing applications for over fifteen years. Most of his time is spent consulting for companies nationwide with troubled projects or mentoring projects to successful completion. When he is not developing software or mentoring clients, Frank is teaching other developers. He has taught thousands of application developers how to create business solutions with Visual Studio .NET. VB.NET, ASP.NET, Visual C#, and SQL Server.