About Me

Professional Practical HumanBeing

Saturday, January 7, 2012

What is View State

The view state is a key element of an ASP.NET page because it is the primary means to persist the state of the Web server controls. Whenever the page posts back, the state is restored, updated using the current form parameters, then used to run the postback event handler. Normally, the view state is a hashed string encoded as Base64 and stored in a hidden field called __VIEWSTATE. In this way, the view state is not cached on the client, but simply transported back and forth with potential issues both for security and performance. As I said, you could keep the view state on the server, which requires only minimal coding. You will pay extra overhead because you're accessing a file off the disk or a database, but you'll be returning much slimmer pages while taking less of a security risk. Although in this column I considered persistent storage on the server (file or database), nothing would really prevent you from using the Cache object, thus combining server-side storage and speed of execution

Difference Between StoredProc and Function

Procedure can return zero or n values whereas function can return one value which is mandatory.

Procedures can have input,output parameters for it whereas functions can have only input parameters.

Procedure allow select as well as DML statement in it whereas function allow only select statement in it.

Functions can be called from procedure whereas procedures cannot be called from function.

Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.

We can go for transaction management in procedure whereas we can't go in function.

Procedures can not be utilized in a select statement whereas function can be embedded in a select statement.



Functions are compiled and executed at run time.
Stored procedures are stored in parsed and compiled format in the database.

Functions cannot affect the state of the database which means we cannot perform insert,delete,update and create operations on the database.
Stored Procedures can affect the state of the database by using insert,delete,update and create operations.

Functions are basically used to compute values. We passes some parameters to functions as input and then it performs some operations on the parameter and return output.
Stored procedures are basically used to process the task.

Function can not change server environment and our operating system environment.
Stored procedures can change server environment and our operating system environment.

Functions can not be invoked from SQL Statements. Execute. SELECT
operating system can be invoked from SQL Statements. Execute. SELECT

Functions can run an executable file from SQL SELECT or an action query.
operating system use Execute or Exec to run