The Temple of Fu

code, systems and games

Archive for July 2010

If temp table exists – Drop it!

leave a comment »

You’ve created a temp table in a stored procedure and now you are testing it which involves dropping a temp table manually if you are not executing the stored procedure in it’s entirety (common if you are testing chunks of it).

So here’s the easy solution. We need to check if the temp table exists within the TempDB database and if it does, we need to drop it. Place the following at the top of your procedure, obviously before creating the temp table =] Now everytime it runs it will drop the table and then recreate it, no more manually dropping the temp table!

IF OBJECT_ID('tempdb..#Temp') IS NOT NULL
DROP TABLE #Temp

Replace #Temp with the name of your temp table.

Hope this helps!

Advertisements

Written by lordfu

July 29, 2010 at 1:50 pm

Posted in Database, MSSQL

Install Ajax Control Toolkit – Visual Studio 2008

with 4 comments

When you create a new ASP.NET application or web-site in VS 2008 that targets the .NET 3.5 framework, VS will automatically add the appropriate AJAX registrations in your web.config file and the core ASP.NET AJAX server controls will show up in your toolbox. This post shows you how to register the rest of the extensions in VS 2008.

Download the Ajax Control Toolkit

Click the Downloads tab at the CodePlex site to see the list of available Ajax Control Toolkit downloads. If you are using Visual Studio 2010 then you can use either the .NET 4 or .NET 3.5 versions of the Ajax Control Toolkit.

Download the Binary version and not the Source version of the Ajax Control Toolkit. You should download the Source version of the Ajax Control Toolkit only when you are interested in extending the Ajax Control Toolkit.

Extract the Download
After downloading the Ajax Control Toolkit, you need to unblock and extract the files. Right-click the compressed file and click the Unblock button.

Next, right-click the compressed file and select the Extract All menu option.

Add the Ajax Control Toolkit to the Visual Studio Toolbox
The next step is to add the Ajax Control Toolkit to the Visual Studio Toolbox. Follow these steps:

1. Launch Visual Studio and create a new ASP.NET Web Forms project or website. Open Default.aspx in the Visual Studio editor.
2. Create a new Toolbox tab by right-clicking the Toolbox and selecting Add Tab. Name the new tab Ajax Control Toolkit.
3. Right-click beneath the new tab and select the menu option Choose Items… Click the Browse button and browse to the folder where you extracted the Ajax Control Toolkit. Pick the AjaxControlToolkit.dll and click the OK button to close the Choose Toolbox Items dialog.

Hope that helps!

Written by lordfu

July 14, 2010 at 4:13 pm

Posted in Ajax, ASP.Net, Development

Breakpoint is hit only for split second

leave a comment »

Frustrating to say the least. Googling makes it even worse because of the vast amount of users that actually receive a message from Visual Studio but that have nothing to do with my problem.

Here was my scenario. I put a break point on the first line of some code within Page_Load, obviously this would get called and is not bound by any condition but it was never hit!

The solution was to make sure all instances of Internet Explorer were closed and then my breakpoint was hit. This affected me in both Visual Studio 2003 and Visual Studio 2005.

Hope that helps.

Written by lordfu

July 12, 2010 at 1:22 pm

Posted in ASP.Net, Development