Monday, 29 July 2013

Create table in sql server

Syntax:

CREATE TABLE table_name
(
column_name1 data_type(size),
column_name2 data_type(size),
column_name3 data_type(size),
....
);

Example:

CREATE TABLE Persons
(
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)

);

Create Database in Sql Server

CREATE DATABASE dbname;

or


CREATE DATABASE my_database;


Friday, 26 July 2013

Caching in Asp.net C#

.NET provides three primary forms of caching:

       page level output caching                                                        easy to implement
        user control level output caching (or fragment caching)         easy to implement 
       Using  Cache Object                                            More flexible throughout every layer of an application

1.   Page Level Output Caching
The simplest form of caching, output caching simply keeps a copy of the HTML that was sent in response to 
a request in memory. Subsequent requests are then sent the cached output until the cache expires, resulting in

 potentially very large performance gains (depending on how much effort was required to create the original page output—sending cached output is always very fast and fairly constant).
You have to give the duration in seconds for the page to be cached.

Implementation:
          <%@ OutputCache Duration="60" VaryByParam="*" %>
This directive, as with other page directives should appear at the top of the ASPX page, before any output.


2.   Fragment Caching, User Control Output Caching
Often, caching an entire page is not feasible, because certain parts of the page are customized for the user.