Returning the Nth weekday in SQL…and in InfoPath
Ok, after much research I found a forum that had a posting that demonstrated how to get the Nth chosen weekday of a month using T-SQL. Here’s the code: DECLARE @date datetimeDECLARE @weekday intDECLARE @day datetimeDECLARE @number intDECLARE @WhichOne int SELECT @WhichOne = 2 — Set this to the week you want to grabSELECT @number = 1SELECT @weekday = 0SELECT @date = getDate() — Change to dateadd(month, 1, getDate()) for next month, etc. WHILE @weekday 4 — Change this value…
Calculating Nth weekday of next month in Excel
I won’t normally post Excel stuff on here, but while researching an XSLT/Javascript function I was determined to get it right in Excel first, so I understood it better, and definitely wanted to document it so I could pull it back up later! In this example, I need to know the second Wednesday of next month, because that’s when server maintenance is every month. But what day is it? Here’s the Excel formula: =DATE(YEAR(TODAY()),MONTH(TODAY())+1,1+7*2)-WEEKDAY(DATE(YEAR(TODAY(),MONTH(TODAY())+1,8-4)) Notice the DAY argument of the…
InfoPath data validation using regular expressions
I found it interesting yesterday, while building an InfoPath template for SharePoint 2007, that you can use regular expression code to perform data validation the same way it’s used in an ASP.Net form, and the same way it’s done in C#. Here’s an example: In my form, I wanted to make sure the data entered conformed to a specific email address format. Normally, an email address pattern looks like this: w+([-+.’]w+)*@w+([-.]w+)*.w+([-.]w+)* This won’t work in InfoPath, there are too many…
Complete TFS 2008 Install Guide
I wanted to use Team Foundation Server 2008 as our development solution for our company, and I had never used it before, so I thought I’d give it a whirl on a VM dev box and see how it goes. I tried opening the Installation Guide, and it didn’t work. I tried opening the one online, and it forced me to download a copy that also didn’t work. So, flying blind I gave it my best shot. After over a…
Import an Excel 2007 spreadsheet into a GridView in ASP.Net
I had a request earlier today for an existing web-based solution written in C# ASP.Net 2.0 to be able to upload an Excel 2007 spreadsheet and have the site immediately read from that file and put the results into a GridView control on the same page for editing, review, etc. I had never done this before, all of my data access was typically SQL, Access, XML, etc. So I did some light research and ended up writing the following code…