Jump to content


Check out our Community Blogs

Barnsite's Blog



SQL Server 2008 R2 Maintenance Cleanup Task Not Deleting bak Files

  Posted by Barnsite, 30 November 2012 - - - - - - · 496 views
programming
I noticed that my old backup files were not being deleted despite my Cleanup Task being set to delete all bak files more than a day old.  Having checked, and double checked the path, file age, etc. I decided it was time to try a couple of random things.
Firstly I added a  to the file path, this seemed to make no difference.  So I then decided to remove the...


Multiple OR’s in T-SQL WHERE Condition SQL Server

  Posted by Barnsite, 30 November 2012 - - - - - - · 618 views
programming
Just been rewriting some SQL Server stored procedures for a client. There were a lot of SELECT statements like the one below:

SELECT
   *
FROM dbo.TABLE
WHERE (field1 = 'SBO' OR field1 = 'RBO' OR field1 = 'PYO' OR field1 = 'TCO'
   OR field1 = 'BRS' OR field1 = 'BMS') AND field2 = 'COMPLETED'...


Null Dates in SQL Stored Procedure called from C# – Conversion Error DateTime2 DateTime

  Posted by Barnsite, 29 November 2012 - - - - - - · 1074 views
programming
One issue with calling stored procedures from C# is with null date parameters.  If you try to pass an unassigned DateTime type to the parameter you will receive an error regarding conversion of DateTime2 to DateTime data type.
One way around this is to use the Nullable DateTime in C#
Lets assume we have the following table (dbo.Fault):
WO_NUMBER...


Assign Event to Multiple Controls, Windows forms and C#

  Posted by Barnsite, 26 November 2012 - - - - - - · 805 views
programming
Lets say that you want the same event to be triggered by multiple controls. You don’t want to have to rewrite the code for all the controls.
Here we’re going to use four buttons with one shared event that shows the name of the button that’s been clicked.
Firstly create a form (in this case Form1) and add four buttons (button1, button2,...