Thursday, July 22, 2010

Directives in ASP.net

Directives specify settings that are used by the page and user-control compilers when the compilers process ASP.NET Web Forms pages (.aspx files) and user control (.ascx) files.

  1. @ Assembly : Links an assembly to the current page or user control declaratively.
  2. @ Control : Defines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls).
  3. @ Implements :Indicates that a page or user control implements a specified .NET Framework interface declaratively.
  4. @ Import : Imports a namespace into a page or user control explicitly.
  5. @ Master : Identifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included only in .master files.
  6. @ MasterType : Defines the class or virtual path used to type the Master property of a page.
  7. @ OutputCache : Controls the output caching policies of a page or user control declaratively.
  8. @ Page :Defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files.
  9. @ PreviousPageType : Creates a strongly typed reference to the source page from the target of a cross-page posting.
  10. @ Reference : Links a page, user control, or COM control to the current page or user control declaratively.
  11. @ Register : Associates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control.

Tuesday, July 20, 2010

On Deletion/Updation Of a Primary Key, Foreign Key will be Deleted Automatically

create table a(ID int Primary key , MyName varchar(100))

create table ab(ID int foreign key references a(ID) on update cascade, Address1 varchar(100))

create table abc(ID int foreign key references a(ID) on update cascade, Address2 varchar(100))

insert into a(ID,MyName) values(1,'Bikash')
insert into ab(ID,Address1) values(1,'Getit')
insert into abc(ID,Address2) values(1,'Tej Building')

drop table a
drop table ab
drop table abc

delete from a where id=1
update a set id=4

In the above query, there is more synchronisation between master and Transaction. When we will delete/Update in Master table, Transaction will be updated/deleted Automatically