www.kevincornwell.com

Visual Studio



Break into Debugger when Exception is thrown

Break into Debugger when Exception is thrown even if you are using try catch statements.

From Visual Studio, hit CTRL + ALT + E. Then check the “Thrown attribute of the Common Language Runtime Exceptions.

untitled.GIF


Post Comment Now


Create and populate a simple calendar table in MS SQL

Edit as required…

USE master
go
 
IF  EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'tCalendar')
BEGIN
DROP TABLE tCalendar
END
go
 
CREATE TABLE tCalendar (
DateID INT IDENTITY(1,1) CONSTRAINT tCalendar_PK PRIMARY KEY CLUSTERED,
DATE DATETIME,
Holiday BIT DEFAULT 0,
Workday BIT DEFAULT 0)
go
CREATE UNIQUE NONCLUSTERED INDEX
tCalendar_date_N_Idx ON tCalendar(DATE)
go
 
--Populate all days
 
DECLARE @n INT
DECLARE @maxn INT
DECLARE @begindate DATETIME
SET @n =1
SET @maxn=36500    -- Number of days added to the calendar
SET @begindate =CONVERT(DATETIME,'01/01/1995')
-- Initial date for the first run is todays date
-- or Jan 1st
SET @begindate =@begindate -1
 
WHILE @n <= @maxn
BEGIN
INSERT INTO tCalendar(DATE) SELECT @begindate+@n
SET @n=@n+1
END
 
--update the holiday and workday flags
 
go
UPDATE tCalendar
SET holiday=1 WHERE DATENAME(dw,DATE) in ('Saturday','Sunday')
go
UPDATE tCalendar
SET workday=1 WHERE holiday=0
go
 
SELECT * FROM tCalendar

Post Comment Now


Visual Studio Syntax Highlighting and Intellisense for Classic ASP

With the new release of Visual Studio (VS) 2005, you would think that it would have full support for classic ASP when working in a directory. This is not the case. There are some hacks out there, however none are fully functional and some require that you set the page directive on every page you want highlighting and intellisense. Of course this will break some of your pages.

For those who want the power of VS (mainly Intellisense), you still need to use vs 2003 until MS makes a fully functional .asp template for VS 2005.

This tutorial will walk you through the process of creating a Solution that allows you to edit your classic ASP in VS 2003. The site must be accessible though windows explorer (C:\ or mapped drives).

  1. Start VS 2003
  2. File > New > Blank Solution
  3. Name it “Classic ASP” or whatever. The location is where the link will be stored for opening the solution and all it’s projects.
  4. Add your sites…
  5. Right Click the Solution “Classic ASP”
  6. Add > New Project > Visual Basic Projects > New Project In Existing Folder
  7. Name it “My ASP Site 1″
  8. Click Ok
  9. Browse to the location of the root folder for that web site.
  10. Single click the project. From the VS menu bar, click Project > Show all Files (or click the second button in the solution Explorer)
  11. Repeat for all your sites/directories.



Now when you start the solution, all the sites and files will be listed from within VS 2003. You now have html, javascript, and vbscript intellisense. You also get param lists when you call functions/subs that are on the same working page. Sweet!

Notes:

  • VS will create a couple of files in the project directories (bin folder, .vbproj, .vbproj.user) . They are harmless and a small price to pay for the power of VS.
  • You may get a warning about a project not being fully trusted by the .NET runtime. That’s ok, we are not using .NET here anyway.

Post Comment Now


Blog | Contact | Gallery | Links | Music | Sandbox | Search | SharePoint | Social Networking | Software | Weather | Web Design


Copyright © 1997-2008 KCSH. All rights reserved.