Google
 

Wednesday, May 28, 2008

"Page not found" error after installing IIS

After you install IIS on a machine that has .net framework installed and you open an ASP.NET page, you will probably get a "Page not found - 404" error.
This is because IIS did not (recognize) the installed .net framework. You simply need to run this command line:

aspnet_regiis -i

You can run it by opening the .NET Framework SDK command prompt or by changing the current directory to "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" and run the command. (The path may differ according to the .net version installed)

Friday, May 16, 2008

How to check query syntax programmatically

A nice feature in MS SQL Server Management studio or the old good query analyzer is the ability to check query syntax before executing it by pressing (Parse) or (Ctrl+F5).

You also can provide this functionality in your application in case your application creates queries on the fly or has a query designer.

This can be done using the PARSEONLY option. Queries that run while PARSEONLY option is ON are parsed but not executed, For example:

SET PARSEONLY ON
Go
Select * from dbo.Books
Go
SET PARSEONLY OFF


The above Select will not be executed, it will only be parsed, the result will be:

Command(s) completed successfully.

Without returning any data.

It's simple, open the database connection, execute "SET PARSEONLY ON", then execute your query, then "SET PARSEONLY OFF"