Monday, 16 November 2015

Difference Between Eval and Bind in Asp.Net

The Eval function is used to define one-way (read-only) binding.
The Bind function is used for two-way (updatable or read/write) binding.
In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the <%# and %> delimiters to execute that code and return a value during page processing.

Thursday, 5 November 2015

Use of SET NOCOUNT in Stored Procedures

SET NOCOUNT ON statement into store procedures can reduce network traffic, because client will not receive the message indicating the number of rows affected by T-SQL statement.

When SET NOCOUNT is ON, the count is not returned.
When SET NOCOUNT is OFF, the count is returned.
The @@ROWCOUNT function is updated even when SET NOCOUNT is ON.

The setting specified by SET NOCOUNT is in effect at execute or run time and not at parse time.

Example:

USE DEMO

GO

SELECT * FROM [DEMO].[EMP];

Message:

12 row(s) affected

USE DEMO

GO

SET NOCOUNT ON

SELECT * FROM [DEMO].[EMP];

SET NOCOUNT OFF

Message:

Command(s) completed successfully.