Setup and Deployment Packages in Visual Studio 2008
Setup and deployment projects are frequently used by developers looking for a user friendly means to install their custom application on end users' computers. The result of creating a setup and deployment project is a portable and easy to use MSI installer package for your software. To create a bare minimum setup and deployment package for a Visual Studio application, follow these steps (written specifically for Visual Studio 2008).
1) Right click on your Visual Studio solution in the Solution Explorer panel in VS. Select "Add -> New Project..."
2) In the available project listing, select "Setup Project". Give it a name and location and click OK.
3) At this point, Visual Studio will display the file system on the target machine in your main development panel. Open the Application Folder here. Right click on the blank file system and select "Add -> Project Output..."
4) Select the project that you're creating this package for in the drop down listing. Then select the "Primary Output" option. Leave the rest of the settings as is and click OK.
5) You should see the primary output as well as any necessary dll files listed in the application folder in the development window. This is good. From here, right click on the setup and deployment project name in the solution explorer and select "Build".
6) Now you're done! The MSI and setup installation files for your custom application will be residing in the output folder that you specified when initially creating the package.
Intalling the AJAX toolkit for Visual Studio 2008
AJAX is a wonderful tool for dynamic web development. Samples of the tools included with the toolkit can be found here:
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/
To install the latest edition of the AJAX toolkit for Visual Studio (in this case, Visual Studio 2008). Take the following steps.
1) Download the toolkit at http://www.asp.net/ajaxlibrary/download.ashx
2) Extract the .ZIP file downloaded anywhere on your hard drive.
3) Open Microsoft Visual Studio 2008. Right click on an empty space in the toolkit window on the left side of the screen. Select "Add Tab".
4) Give the tab a name. Right click under the named tab and select "Choose Items...". Once the .COM object window appears, click the "Browse" button.
5) Navigate to the folder where you extracted the AJAX toolkit .ZIP file. Select the AjaxControlToolkit.dll file there. Click OK to add the toolkit - and you're done!
Using CASE statements in T-SQL
One of the more useful and flexible expressions in T-SQL is the CASE statement. Have you ever been asked to write a report that returns data in an unnatural form, or with slight alterations to the stored fields? Using a SELECT CASE can usually fit your needs without altering database table structure. Lets go through a couple of examples.
Customer A wants a report of all of their vendors and total dollar sums for each type of item purchased. You have a table in your database listing all orders which have fields for the vendor, the type of order, and the billing amount. Writing a query like the following will return the requested data.
SELECT Vendor, SUM(Type_A$), SUM(Type_B$)
FROM (SELECT Vendor, CASE WHEN Type = 'A' THEN Billing$ ELSE 0.0 END AS TypeA_$, CASE WHEN Type = 'B' THEN Billing$ ELSE 0.0 END AS TypeB_$ FROM Orders) AS VMatrix
GROUP BY Vendor
Customer B wants a report that determines and displays a category for orders made (category being a field type that is not stored in the database).
SELECT Vendor, Order,
CASE
WHEN Billing$ < 10.0 THEN 'Cheap' WHEN Billing$ >= 10.0 AND Billing$ < 100.0 THEN 'Average'
ELSE 'Expensive'
END AS BillingCategory
FROM Orders