Sunday, January 27, 2013

How to send email notification when job fails on SQL server 2008

Problem

On a new SQL server 2008 system we deployed a job that runs on a regular schedule. The job contacts remote servers and when there is a connection problem we would like to be notified.

Solution

3 configurations are necessary

  • Database Mail Configuration Wizard
    • sp_CONFIGURE 'show advanced', 1
      GO
      RECONFIGURE
      GO
      sp_CONFIGURE 'Database Mail XPs', 1
      GO
      RECONFIGURE
      GO



  • Set the Mail Profile for SQL Server Agent


  • Create a SQL server agent Operator

Monday, January 21, 2013

Using a custom edit screen in Lightswitch 2012 instead of the default modal dialog window

When you add a new Details Screen and check the ‘Use as default Details screen’, it will be used as edit screen by the Search Data screen, but not by the Editable grid screen.

In the Editable grid screen you need to write code behind the Edit button to open the Edit Details screen.

However instead of explicitly opening the Edit Details Screen by name, you can use the entities default screen property.

Instead of writing

partial void gridEditSelected_Execute()
{

Application.ShowCreateNewCustomerEdit(this.Customers.SelectedItem.Id);
}

Write this


partial void gridEditSelected_Execute()
{


this.Application.ShowDefaultScreen(this.Articles.SelectedItem);
}


This tip came from Justin Anderson on one of the Lightswitch msdn fora.