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