Monday, June 27, 2011

Database Design Guidelines

References :

1.Best practices SQL Server naming conventions
http://www.sqlservercentral.com/articles/Naming+Standards/2895/

2.Best practices SQL Server naming conventions
http://vyaskn.tripod.com/object_naming.htm

3)10+ common questions about SQL Server data types
http://www.techrepublic.com/blog/10things/10-common-questions-about-sql-server-data-types/355

4)Composite Primary Keys

Date time vs small datetime in sql server 2005

DATETIME column must fall within the range of January 1, 1753, through December 31,
9999.

SMALLDATETIME column must fall within the range of January 1,
1900, through June 6, 2079.

Hence we can use Smalldatetime for most of our apps.

Ref:http://suryan72.blogspot.com/2008/08/date-time-vs-small-datetime-in-sql.html

Saturday, June 18, 2011

How to disable a button after click it in Asp.net?

How to disable a button after click it in Asp.net?

Solution :

Button1.Attributes.Add("onclick", "javascript:" + Button1.ClientID + ".disabled=true;" + ClientScript.GetPostBackEventReference(Button1,""))

This can help avoid multiple submissions by a single buttons.

Friday, June 17, 2011

'Thread is being aborted' when using Response.Redirect

Issue :'Thread is being aborted' when using Response.Redirect

FIX: If you want to get rid of this exception, use Response.Redirect(url, false).

Cause explanation:
Your page is executing by a thread on which asp.net worker process contains. And on some line in your code, an instruction (Response.Redirect) wants to stop the execution because it must be stopped and asp.net framework must be notified about a redirection request.

Asp.net framework catches the Redirect method's exception, aborts the thread and use a new thread for execution of to be redirected page.

This occurs when you specify the second argument of Redirect method as True. Because this means to asp.net framework as 'Stop this page's execution ASAP and execute to be redirected page'.

Ref:http://p2p.wrox.com/asp-net-1-0-1-1-basics/5684-thread-being-aborted.html

Friday, June 3, 2011

TRY...CATCH + BEGIN TRANSACTION in SQL Server a good way for error handling

TRY...CATCH + BEGIN TRANSACTION in SQL Server a good way for error handling than just @@error since the later gives only if last statement made error unlike the former which tracks if error occurs in any statement in that block.
BEGIN TRANSACTION
BEGIN TRY
Try Statement 1
Try Statement 2
...
Try Statement M
END TRY
BEGIN CATCH
ROLLBACK
Catch Statement 1
Catch Statement 2
...
Catch Statement N
END CATCH

COMMIT

Ref: http://www.4guysfromrolla.com/webtech/041906-1.shtml

Thursday, June 2, 2011

Devops links

  Build Versioning in Azure DevOps Pipelines