Monthly Archives: December 2012

Using Standard Templates for ListView and GridView

Thumbnail for 559

When creating XAML applications using ListView and GridView controls for Windows 8, you probably want your applications to look like “standard” applications. You can reverse-engineer existing applications, but Microsoft makes it a little easier than that. In the documentation, if you search a bit, you’ll find two pages that list some sample, standard DataTemplate examples you can use for your own applications.

For the ListView control, look here:

For the GridView control, look here:

You’ll find two problems with these templates. First, they include hard-coded text, and it’s up to you to replace the hard-coded text with binding expressions that work with your own data source. In addition, some of the templates don’t work well with “real” data, and you may need to modify them slightly to work with your bound data. In general, however, these templates can save you a lot of time. Review them all to see what Microsoft has provided. If there’s not an exact match for your application, you can at least use one of these as a starting place.

Thumbnail for 559Ken 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.

Keeping Up with Online Business


One of the most important things for a business is to obtain a positive online presence in order to succeed. A business’ online presence is the one thing that gives it validity and a greater chance for more customers to visit the website, trust its source, and ultimately make more sales. If a company does not have a reputable website, or does not come up in internet search engines, individuals often question how great the company and its products or services are. This prevalence of online business has now forced companies to focus on the importance of programming and web knowledge. One of the most important aspects is to able to design an effective, great looking website which will help the overall goals of the company.

If you are a company that is looking to enhance your website and design, one of the most important things is to ensure your employees are receiving adequate technical training. Taking part in an MVC 3 tutorial and a HTML5 tutorial can teach important programming skills that are needed to create the best performing websites. If you are looking to enhance your skills these tutorials can ensure you will get the best training from trained experts, and you are able to access this information at any time when you may need to be refreshed. Don’t wait, sign up and enhance your computer skills today.


var s=’hubspotutk’,r,c=((r=new RegExp(‘(^|; )’+s+’=([^;]*)’).exec(document.cookie))?r[2]:”),w=window;w[s]=w[s]||c,
hsjs.type = “text/javascript”;hsjs.async = true;
hsjs.src = “//” + encodeURIComponent(c);
setTimeout(function() {try{”visible”;}catch(err){}}, 2500);


Computed Columns in SQL Server Management Studio (SSMS)

Formula property in computed columns

Computed columns in SQL Server Management Studio (SSMS) allow you to configure a column within a table that automatically calculates a value based on an expression that can include references to other columns. For example, in the Course table you could have a PricePerUnit and a Units column, plus a Total column, as shown in the Figure below, where the Total column has the following Formula property:

If a value in either the PricePerUnit or the Units column changes, the Total column is automatically recomputed. However, by default this value is not actually storedit is calculated and returned when needed, as in a query or view. The calculated value is stored on disk only if you index the column, which is what happens if you set Is Persisted to Yes.

TIP: When you modify a table’s design with Management Studio, such as to add the formula for the Total computed column, and then click the Generate Change Script button on the left side of the toolbar, you’ll see the T-SQL that Management Studio uses to make the change. This T-SQL does not represent the most efficient way of making the change. (You’ll need to uncheck the Prevent saving changes that require the table to be recreated in the Tools|Options dialog box in the Designers|Table and Database Designers page. This option is checked by default.)

For every change or set of changes that you make, Management Studio creates a new table, copies any data in the old table into the new one, deletes the old table, and then renames the new one with the same name as the old. This is not necessary it is just an easy way for Management Studio to avoid creating different scripts for every kind of change.

When you write the T-SQL yourself, you can use an ALTER TABLE statement that makes only the necessary change or changes to the existing table without creating a new table. That can make a big difference in the time required to change a table that contains lots of data.

Save the change to the Course table. You’ll get a Save dialog box that verifies that you want to change the tables in the database, as shown in the Figure below. Select Yes to make the change.

verifying you want to change table

ldn-expertdkielyThis post is an excerpt from the online courseware for our SQL Server 2012: Configuring Management Studio course written by expert Don Kiely.

Learning C# Online

Thumbnail for 666

It may seem like there are so many steps to start the process of becoming an expert in the language of programming. One of the most important languages to learn in programming is C#. If you are just starting out, the amount of information you can find dealing with C# can seem extremely overwhelming. One of the easiest and least stressful ways to begin training for this type of programming is through an online C# instructional video course.

By engaging in instructional video tutorials for C#, you can be sure that you are receiving accurate information from expert programmers and developers. You are able to take your time, write notes, and access the learning materials whenever you may need to. Learning the material at your own pace can be one of the best ways to ensure you grasp the language of the programming. Online C# video courses are one of the best options to ensure you are on your way to becoming the best developer you can be.


var s=’hubspotutk’,r,c=((r=new RegExp(‘(^|; )’+s+’=([^;]*)’).exec(document.cookie))?r[2]:”),w=window;w[s]=w[s]||c,
hsjs.type = “text/javascript”;hsjs.async = true;
hsjs.src = “//” + encodeURIComponent(c);
setTimeout(function() {try{”visible”;}catch(err){}}, 2500);


Protecting Your Data in SQL Server


The transaction log is fundamental to the way SQL Server works and is created automatically when you create a new database or attach an existing database that doesn’t yet have a log file. The transaction log records almost all activity in the database and provides an extra layer of protection for your data. SQL Server uses a write-ahead strategy to maintain the log, taking the following actions for any data modification:

  1. Loads data pages into a buffer cache.
  2. Updates the copy in the buffer.
  3. Creates a log record in a log cache.
  4. Saves the log record to disk via the checkpoint process.
  5. Saves the data to disk.

If a system failure occurs, you can restore the database from a backup, then apply transactions from the transaction log to recover data changes that occurred after the last backup, and that would otherwise be lost. With complete backups of all transaction logs, you can restore the database to any point in time. This scheme provides remarkable resiliency to almost any kind of failure, short of a total system meltdown. And support is available even for surviving the devastating meltdown of a single server.

The transaction log is a separate data file (.ldf) that by default resides in the same location as the data file, but you’ll often want to place log files on a separate device from the data files for additional security and performance. SQL Server supports three recovery models for recovering from a database server meltdown: simple, full, and bulk-logged.

  • Simple: The log is truncated at a checkpoint, so that recovery takes the database back to the point of the last full or differential backup. A checkpoint is a known good point from which SQL Server can start applying changes from the log during recovery from a failure.
  • Full: All database operations are fully logged so that you can recover the database to the point of failure.
  • Bulk-Logged: Enables faster bulk-logged operations so that recovery is limited to logged transactions that occurred after the last backup.

TIP: The Recovery Model property of a database determines how the database uses its transaction log. A Simple setting for the Recovery Model keeps the log small by truncating the log after each checkpoint process. With this setting, the log supports each transaction while it is in progress, but database recovery relies on the last full backup of the database and cannot use the transaction log to restore data changes that occurred after the last backup.

ldn-expertdkielyThis post is an excerpt from the online courseware for our SQL Server 2012: Configuring Management Studio course written by expert Don Kiely.

Tools for Writing T-SQL Queries in the Microsoft World


Most modern code development environments have support for writing code. In the Microsoft world, one of the primary tools is IntelliSense, which presents a list of objects and keywords as you type code. In SQL Server’s Management Studio, a related feature that isn’t really IntelliSense but helps you write good code is syntax checking, which marks T-SQL syntax errors with squiggly underlines when it detects a problem.

The Figure below shows IntelliSense in action. In a Query Editor window, with the database context set to AdventureWorks2012, start typing a SELECT statement. IntelliSense can’t help much with “SELECT * FROM”, but once you type that, it is obvious that the next element is a database name, a schema name from the database context, or a table name. So IntelliSense pops up a list of possibilities, and as you continue to type, it narrows the possibilities. You can continue typing at this point, or press the TAB key to select Sales. The list contains every object name that would work in a FROM clause within the current database context. In this case, it is a couple of system objects that happen to have “sa” somewhere in their name, as well as Sales, which is a schema name in the AdventureWorks2012 database.

Once you have the schema name, type the period. IntelliSense pops up a list of schema objects that you may want, as shown in the Figure below, and a ToolTip if you hover the mouse over any of the items. You can use the arrow keys to move up and down the list, or continue typing. This shows how IntelliSense functions as both a typing shortcut as well as an easy reference to available objects in the context of the code.

using intellisense to select a schema object

IntelliSense is by no means perfect, and sometimes it is of no help if it can’t identify any context for the statement you are writing. But when it can do its job, it can be a big help writing code.

TIP: If IntelliSense drives you nuts, particularly if you just can’t get used to the lists popping up all the time, you can shut it off or customize it in simple ways. Go to Tools|Options, and drill down to the Text Editor|Transact-SQL|IntelliSense node. You can turn off syntax checking separately from IntelliSense. But Microsoft has vastly improved IntelliSense for T-SQL in Management Studio, and it now an effective productivity tool.

IntelliSense also helps with syntax checking. Make a spelling mistake in a statement, and even before you finish, as you can see in the Figure below where we have misspelled “SLECT,” IntelliSense shows a red squiggly underline to indicate a problem.

Syntax checking

You have to be careful with this, because the actual problem may not be in the current statement; it could be in the previous statement, but at least it provides the context for the problem. And IntelliSense often doesn’t recognize valid objects, or takes a minute or more to get caught up with everything when you change database context. So if it works for you, make good use of it. If it is just an annoyance, turn it off. On a reasonably fast machine, IntelliSense usually performs well.

Thumbnail for 566This post is an excerpt from the online courseware for our SQL Server 2012: Configuring Management Studio course written by expert Don Kiely.

SQL Server Management Studio: Displaying Multiple Code Windows


You have several options for viewing and manipulating multiple code windows.

When you have two or more queries open, you can right-click the title bar of the Query Editor and choose either New Horizontal Tab Group (see the Figure below) or New Vertical Tab Group. The same options are available from the main Window menu in Management Studio.

If you select a new horizontal tab group, you’ll see something like the Figure below. Note that each window still can maintain an independent connection to an instance of SQL Server; you can see this information in the status bar at the bottom of each query editor window. Each of the tab groups you create can contain multiple query editor windows.

The Query Editor in a horizontal tab group

To move the active window to another tab group, choose Window|Move to Next Tab Group or right-click the title bar and choose Move to Next Tab Group. The option in either case might be Move to Previous Tab Group if a window in the second tab group is active. Or, you can simply drag the window to another group.

There are three ways to un-split the window:

  • If the window you move is the last one in a tab group, the empty tab group will automatically close.
  • Close all of the query editor windows in a tab group.
  • Drag all of the query editor windows from a tab group to another tab group.

TIP: To maximize the Query Editor window, press SHIFT+ALT+ENTER. Press it again to switch back to Normal view. This keyboard shortcut works with any document window.

If you select the Window|Close All Documents option from the main menu, all documents and all tab groups will close. You’ll be prompted to save any files in windows with unsaved changes. Management Studio has your back!

ldn-expertdkielyThis post is an excerpt from the online courseware for our SQL Server 2012: Configuring Management Studio course written by expert Don Kiely.

Learn and Grow with Time for Dinner

When you have a family, it seems like there is really no good time to study. If you are taking courses at night or on the weekends, at a local Instructor led Training Company or college, for example, you run the risk of missing out on important family functions, school activities, and even just evening meals together. Learning new skills, especially those related to technology and the workplace, can give you a major leg up in your corporation. However, the time required to attend classes can leave you feeling guilty and stressed about what is not getting done at home.

An online HTML5 tutorial or online courses can help circumnavigate many of these issues. By taking courses online, you can choose the when, where, and duration of your learning/studying time. The flexibility of choosing your own “classroom” time means that you can truly focus when you sit down to study, rather than wondering what is going on at home. You can learn a new skill or program, increase your value at work, and still tuck your kids into bed at night. That’s a win-win for everyone.

SQL Server Management Studio: Displaying and Filtering Objects

sql production schema

SQL Server Management Studio displays server and database information in Object Explorer, which presents information about database objects in a treeview. In addition to displaying SQL Server Database Engine objects, Object Explorer also displays Analysis Services, Reporting Services, Integration Services, and other objects. You can also use it to administer SQL Server Security, SQL Server Agent, Replication, and Database Mail. It provides you with deep insight into just about every corner of an instance of SQL Server and all its services.

The Object Explorer displays information in a hierarchical treeview for all servers to which it connects. It populates the treeview on demand when you expand a node. You can double-click a node to expand it, and click the Stop button to stop the expansion.

Displaying and Filtering Objects

Object Explorer can display up to 65,536 objects. If you want to view additional objects, you need to close some nodes or apply a filter to reduce the number of displayed objects. To filter the view, select the parent node that you want to filter, then right-click and choose Filter|Filter Settings. For example, in the Tables node you can filter by Name, Schema, Owner, or Creation Date and you can choose which operator to use for each, as shown in the Figure below for the AdventureWorks2012 database. Click OK to display only tables in the Production schema.

When you filter a list of items, Object Explorer displays that information in the node name, as shown in the Figure below. This way, you don’t forget that it is filtered when you’re looking for an object that the filter excluded.

filtered view in object explorer

To remove the filter, right-click the node where you applied the filter and choose Filter|Remove Filter. Now all the database tables again appear in the Tables node.

ldn-expertdkielyThis post is an excerpt from the online courseware for our SQL Server 2012: Configuring Management Studio course written by expert Don Kiely.