05 February, 2013

SQLServer Quick Tasks


Deleting Database Objects
--SQLServer performs this action when we right click on any database object and select delete option.
DROP TABLE [dbo].[TableName]
DROP VIEW [dbo].[ViewName]
DROP PROCEDURE [dbo].[ProcedureName]



--Copy Table from one database to another
SELECT * INTO DatabaseName.dbo.DestinationTableName FROM DatabaseName.dbo.SourceTableName;

04 February, 2013

GridView


Data Keys

Data Keys must be present in the datasource of GridView i.e. DataKey must be select statement that is used to populate GridView.

ASP.NET


C#
Object key = GridView1.DataKeys[rowIndex].Value; //For single DataKey
Object key = GridView1.DataKeys[rowIndex].Values["LastName"]; //For Multiple DataKeys


Heading

18 January, 2013

Regular Expressions for Validation

Regular Expressions

Email: ^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$

Amount: (^\d*\.?\d*[0-9]+\d*$)|(^[0-9]+\d*\.\d*$)

Name: ^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$