Microsoft Technology


Posted: 29 Jun 2010 08:41 AM PDT
Throw
Throw Ex
try

   {

        // do some operation that can fail

   }

   catch (Exception ex)

   {

        // do some local cleanup

        throw;

   }
try

   {

        // do some operation that can fail

   }

   catch (Exception ex)

   {

        // do some local cleanup

        throw ex;

   }
It preserve the Stack information with Exception
It Won't Send Stack information with Exception
This is called as "Rethrow"
This is called as "Breaking the Stack"
If want to throw new exception,

throw new ApplicationException("operation failed!");
If want to throw new exception,

throw new ApplicationException("operation failed!",ex);
Posted: 29 Jun 2010 07:03 AM PDT
Finalize
Dispose
Implicit way to destroy the object
Explicit Way to Destroy Object
It Cannot Override
It Can be Override
It freed up the memory used by the object only when scope of the expired
Dispose is forcibly freed up the memory
It is called by GC at runtime
It is called by user
If you call finalize, it will move to finalize queue, GC will finalize the object by freed up the memory
It will directly freed up the memory
It will be handling by GC, no inconsistent error occur
Error will occur, because it is not controlled by GC
Posted: 29 Jun 2010 03:49 AM PDT
Functions (UDF)
Stored Procedures (SP)
Execute Functions thru SQL Statement
It Can not be used in SQL Statements
UDF run thru SQL SELECT
SP run thru EXECUTE OR EXEC
You can't use DDL, DML statements in UDF
It is possible in SP
It always return values
It May or May not return value
UDF return single resultset
SP can return multiple resultset
Function can't return XML output
SP can return XML output
UDF can have only Input Parameter
SP can have Input & Output Parameter
SP can not call thru Functions
Function can be called from SP
Exception handling is not Possible
Exception Handling is possible
Posted: 28 Jun 2010 10:38 PM PDT
Composite Key is a primary key, combination of more than one column to maintain unique record. It is also known as Concatenated Key or Aggregate Key

For example:

CREATE TABLE InvoiceDetails (
      InvoiceNo numeric(18,0),
      itemNumber numeric(18,0),
      productId  int,
      quantity   numeric(18,2),
      PRIMARY KEY (InvoiceNo, itemNumber))

InvoiceDetails table may have a composite key on InvoiceNo & itemNumber
Posted: 28 Jun 2010 10:10 PM PDT
It is a Database concept, it maintain the consistent relation between parent and child tables. When one table contains FK, it may not allow inserting any values in key columns of the child tables which is not existed in parents table. It supports cascading update and cascading delete, which ensures the changes made to the child table will be reflected in parent table as well.
Posted: 28 Jun 2010 08:52 PM PDT
You can use any of the following queries to retrieve list of all databases

SELECT name FROM sys.databases
SELECT name FROM sys.sysdatabases

Or you can use the following system stored procedure

EXEC sp_databases
EXEC sp_helpdb

Comments

Popular posts from this blog

C# Constructor

Hiding vs Overriding