Translate This Blog

What is the purpose of connection pooling in ADO.NET?

Connection pooling enables an application to use a connection from a pool of connections that do not need to be re-established for each use. Once a connection has been created and placed in a connection pool, an application can reuse that connection without performing the complete connection creation process.

By default, the connection pool is created when the first connection with a unique connection string connects to the database. The pool is populated with connections up to the minimum pool size. Additional connections can be added until the pool reaches the maximum pool size.

When a user request a connection, it is returned from the pool rather than establishing new connection and, when a user releases a connection, it is returned to the pool rather than being released. But be sure than your connections use the same connection string each time. Here is the Syntax

conn.ConnectionString = "integrated Security=SSPI; SERVER=192.168.0.123; DATABASE=MY_DB; Min Pool Size=4;Max Pool Size=40;Connect Timeout=14;";


What is the basic functionality of Garbage Collector in Microsft.Net?

The Common Language Runtime (CLR) requires that you create objects in the managed heap, but you do not have to bother with cleaning up the memory once the object goes out of the scope or is no longer needed. The Microsoft .NET Framework Garbage Collector provides memory management capabilities for managed resources. The Garbage Collector frees objects that are not referenced and reclaims their memory. You should set your references to Nothing(null) as soon as you are done with them to ensure your objects are eligible for collection as soon as possible.
Here are the list of some tasks performed by the Garbage collector:

Garbage collector reserves a piece of memory as the application starts for the managed heap.
Garbage collector controls the managed heap memory currently used and available to an application.
Garbage collector allocates memory for new objects within the application.
The Garbage Collector attempts to reclaim the memory of objects that are not referenced.

Aggregate Functions in SQL SERVER 2008

What are Aggregate functions? Explain Aggregate functions in SQL SERVER 2008 with example.

Aggregate functions are applied to a group of data values from a column. Aggregate functions always return a single value.

SQL SERVER 2008 / Transact-SQL supports following aggregate functions:

AVG: Calculates the arithmetic mean (average) of the data values contained within a column. The column must contain numeric values.

MAX and MIN:
Calculate the maximum and minimum data value of the column, respectively. The column can contain numeric, string, and date/time values.

SUM: Calculates the total of all data values in a column. The column must contain numeric values.

COUNT: Calculates the number of (non-null) data values in a column. The only aggregate function not being applied to columns is COUNT(*). This function returns the number of rows (whether or not particular columns have NULL values).

COUNT_BIG: New and Analogous to COUNT, the only difference being that COUNT_BIG returns a value of the BIGINT data type.

Aggregate function Example:
SELECT ProjectName, SUM(budget) TotalBudget FROM Project_Tbl GROUP BY ProjectName;

SQL Server Basic Databases

SQL Server Interview Question. Name the Basic or Default Databases of SQL SERVER and What are their functions and use.?

Microsoft SQL SERVER Provides 4 default databases

The Master database holds information for all databases located on the SQL Server instance and is the glue that holds the engine together. Because SQL Server cannot start without a functioning master database, you must administer this database with care.


The tempdb holds temporary objects such as global and local temporary tables and stored procedures. The model is essentially a template database used in the creation of any new user database created in the instance.


The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.

SQL Server 2008 advantages for Developers

Microsoft has released a new version of its popular Database management system (SQL Server). It is Microsoft SQL Server 2008. So what are the benefits of SQL SERVER 2008 for Developers & Programmers.


SQL Management Studio improvements including IntelliSense.

New Data Types for just dates or times (no more storing time when you only need the date).

New Hierarchical data support .IsDescendent(), that can automatically pull a hierarchical view of data (no more custom recursive queries).

New Grouping Sets statement which enables you to automatically group dimensions in a query for easy aggregation and reporting.

New Merge statement which provides automatic insert/update semantics for keeping multiple data sources in sync.

New data types and support for Geodata and geometry.

New support for optimizing "empty" or row/column tables using the sparse keyword.

New FileStream attribute that enables you to include files that are stored in the server file system, but can be managed by SQL Server.

What is the difference between .Net Remoting and Asp.Net Web Services?

ASP.NET Web Services Can be accessed only over HTTP but .Net Remoting Can be accessed over various protocols like TCP, HTTP, SMTP etc.

Web Services are based on stateless service architecture but .Net Remoting support for both stateful and stateless environment.

Web Services support heterogeneous environments means interoperability across platforms but .Net remoting requires .Net on both server and client end.

.NET Remoting provides the fast communication than Web Services when we use the TCP channel and the binary formatter.

Web services support only the objects that can be serialized but .NET Remoting can provide support to all objects that inherit MarshalByRefObject.

Web Services are reliable than .Net remoting because Web services are always hosted in IIS.

Web Services are ease to create and deploy but .Net remoting is bit complex to program.
Previous
Next Post »
Thanks for your comment