Author Archives: calvin998

Crosstab Query (3)

DECLARE @Names VARCHAR(8000) SELECT @Names = COALESCE(@Names + ‘, ‘, ”) + Name FROM People SELECT @Names Or this post about FOR XML PATH

Posted in SQL | Leave a comment

Southern California .NET user groups

Orange County Master Calendar of many developer user groups in the OC and in San Diego – V_Next Orange County – XPSoCal (Agile) – Orange County .NET User Group — Orange County Android UG – reading

Posted in Uncategorized | Leave a comment

Injecting Values for Default MVC Model Binding

In a recent project, due to security concerns, we want to encrypt all QueryString values into a single encrypted value before placing the link in web pages, then decrypt it back to individual name/value pairs and pass them to default … Continue reading

Posted in ASP.NET, MVC | Tagged , | Leave a comment


A good link: Useful commands: DBCC USEROPTIONS SELECT SESSIONPROPERTY(‘numeric_roundabort’) NUMERIC_ROUNDABORT seems is a server level (or user session level) setting. Because when I change it on one DB, all other DBs are changed too. If use Visual Studio Database project, make … Continue reading

Posted in SQL | Tagged | Leave a comment

Why the view doesn’t display the new values set in the post back method

In MVC, when you post back any changes, it’s recommended that you follow the PRG (Post-Redirect-Get) pattern to the View page. However, if you want to display the same model data back in the same request, there might be something … Continue reading

Posted in MVC | Tagged | Leave a comment

TFS – “The path … is already mapped in workspace …”

After installing some power too, my VS 2010 now always run under another admin account of me. So my previous mapping of the projects are lost and I can’t check out files to the original local path. The above error … Continue reading

Posted in Tools | Tagged | Leave a comment

SQL command always times out after 30 seconds

One of my query takes more than 30 seconds to run. Even I set the “Connection Timeout=120” in my connection string, it still throwing timed out exception. It turned out that the time out setting in the connection string is … Continue reading

Posted in .NET, SQL | Tagged | Leave a comment

Src=” causes double page requests

A html tag with src=” (ie img) will cause the browser to try to request that resource at the same URL as the current page, hence causes double requests.

Posted in ASP.NET | Tagged , | Leave a comment

Formatting Dates, Times and Numbers in C#

Good reference (with examples)

Posted in ASP.NET | Tagged , | Leave a comment

Crosstab query (2)

Part one here. Another way to do vertical to horizontal query. Let’s have a table with sales_id, prod_id, sales_date, and sales_amount fields. This query will return 4 latest sales_id in 3 columns: SELECT prod_id, (SELECT TOP 1 sales_id FROM table … Continue reading

Posted in SQL | Tagged | Leave a comment