Saturday, July 28, 2012

Difference between User control & Custom controls


User control

1) Reusability web page
2) We can’t add to toolbox
3) Just drag and drop from solution explorer to page (aspx)
4) U can register user control to. Aspx page by Register tag
5) A separate copy of the control is required in each application
6) Good for static layout
7) Easier to create
8)Not complied into DLL
9) Here page (user page) can be converted as control then
We can use as control in aspx

Custom controls

1) Reusability of control (or extend functionalities of existing control)
2) We can add toolbox
3) Just drag and drop from toolbox
4) U can register user control to. Aspx page by Register tag
5) A single copy of the control is required in each application
6) Good for dynamics layout
7) Hard to create
8) Compiled in to dll

Difference between abstract class and interface


1. Abstract class is a class which contains one or more abstract methods, which has to be implemented by sub classes. Interface is a Java Object containing method declaration and doesn't contain implementation. The classes which have implementing the Interfaces must provide the method definition for all the methods.

2. Abstract class is a Class prefix with a abstract keyword followed by Class definition. Interacace is a Interface which starts with interface keyword.

3. Abstract class contains one or more abstract methods. Whereas Interface contains all abstract methods and final declarations.

4. Abstract class contains the method definition of the some methods. But Interface contains only method declaration, no definition provided.

5. Abstract classes are useful in a situation that some general methods should be implemented and specialization behavior should be implemented by child classes. Interfaces are useful in a situation that all properties should be implemented we can use this scenario

When to Use
If the functionalites(declaration and definition) is same for all classes in the project and that is mandatory that time we use Abstract class.
If the declaration is same but the implementation logic is going  differ in class to class that time we use Interface

Difference between Class and Structure


1)    structure :- In structure have a by default public.
In class have a by default private.
2)    Structure cannot be inherited. But class can be
inherit.
3)    There is no data hiding features comes with
structures. Classes do, private, protected and public.
4)    A structure can't be abstract, a class can.
5)    A structure is a value type, while a class is a
reference type.
6)    A structure is contain only data member , but class
contain data member and member function.
7)    In a Structure we can't initilse the value to the
variable but in class variable we assign the values.
8)    Structure are value type, They are stored as a
stack on memory. where as class are reference type. They
are stored as heap on memory.


note: 'this' pointer will work only in class.

Difference Between Data-set & Data-reader :


Candidate Key, Primary Key, Unique Key :


Candidate Key – A Candidate Key can be any column or a combination of columns that can qualify as unique key in database. There can be multiple Candidate Keys in one table. Each Candidate Key can qualify as Primary Key.

Primary Key – A Primary Key is a column or a combination of columns that uniquely identify a record. Only one Candidate Key can be Primary Key.

1)Primary key is nothing but it is uniqly identified each row in Table.
2) Primary key does not Allows Duplicate values and Null values.
3) Primary key is default Clustered indexes
4) one table can have only one Primary key.

Unique Key:
1)Unique Key is nothing but it is uniqly identified each row in Table.
2) Unique Key does not Allows Duplicate values but allows only one Null value.
3) Primary key is default Non- Clustered indexes

Primary key: -
                     1) Can only one in a table
                     2) We can't insert duplicate value or same value
                     3) Can use as a foreigner key for other table
                     4) It never allow Null values.
Unique key: -
                     1) there can be more than one unique key in one table
                     2) Unique key can have Null Values
                     3) It can't be a candidate key

Difference between : Functions & Stored Procedure


Functions
·         can be used with Select statement
·         Not returning output parameter but returns Table variables
·         You can join UDF
·         Cannot be used to change server configuration
·         Cannot be used with XML FOR clause
·         Cannot have transaction within function

Stored Procedure
·         have to use EXEC or EXECUTE
·         return output parameter
·         can create table but won’t return Table Variables
·         you can not join SP
·         can be used to change server configuration
·         can be used with XML FOR Clause
·         can have transaction within SP