What is Linq ?

LINQ stands for Language Integrated Query. We can use Linq to query various types of data stores like SQL Server, XML etc. With use of Linq we can work with different data sources using similar coding style and there is no need to learn syntax of the data store. Linq also provides intellisense support and compile time error checking.

Linq was introduced in 2008 with .net framework 3.5. LINQ offers a compact, expressive, and intelligible syntax for manipulating data.

Explain about SqlConnection object

SqlConnection object is used to establish a connection with the database using database connection string. The database connection string consists of the location of database and type of authentication like windows or SQL server.

Explain about SqlCommand object

SqlCommand object is used along with Sqlconnection object to send or receive data from database.
The SqlCommand object carries the SQL statement we need to execute on the database.

Explain connected and disconnected architecture in ADO.NET

The ADO.net architecture, in which connection must be kept open till the end to retrieve and access data from database is called as connected architecture. Connected architecture is built on the these types – connectioncommanddata reader
The ADO.net architecture, in which connection will be kept open only till the data retrieved from database, and later can be accessed even when connection to database is closed is called as disconnected architecture. Disconnected architecture of ADO.net is built on these types – connectiondata adaptercommand builder and dataset and data view.

What is index and what are the uses?

Indexes are used to retrieve data from the database very fast. The users cannot see the indexes, they are just used to speed up searches/queries.

Without an index when we run a select query on a Customer database with three columns customername, customerage and customerphonenumber with 1000  records to look for customer name “John”, the database software would literally look at each and every row of the database. Even if it finds “John” it would still look at remaining rows because there may be other customers too with same name.
So, to make this kind of searches fast we make of indexes. Indexing is a way of sorting several records on multiple fields. When we create an index on a field in a table it will create another data structure which holds the field value, and pointer to the record it relates to. This index structure is then sorted, allowing Binary Searches to be performed on it.

Explain about Triggers in SQL

database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database. The trigger is mostly used for maintaining the integrity of the information on the database.

The database trigger are executed either before or after our required code. By default it is executed after.

Example:CREATE [OR REPLACE ] TRIGGER trigger_name  
{BEFORE |AFTER |INSTEAD OF}
{INSERT [OR] | UPDATE [OR] |DELETE}
[OF col_name]
on table_name

What is connection pooling in ADO.NET

When we create a connection to a database it is time consuming as it involves network-level handshaking and security credentialing for every new connection. In ADO.NET we use connection pooling, which reduces the cost of repeatedly opening and closing connections. In connection pooling the object we created for connection is sent to a pool rather than to a garbage collector and whenever we use the same connection string, it uses the object from pool instead of creating a new connection. There will be individual pools for each connection string and with same connection string we can have many connection objects.

By default pooling is enabled and we can turn off pooling for a specific connection by including the Pooling=false key-value pair in our connection string.