Use Parameters in Stored procedures
Using stored procedures in asp.net application helps in various ways to run couple of SQL statements, and makes the applications to get the data by calling those procedures. When using stored procedures, the parameters have to be sent to while executing the stored procedures.
SqlParameter to pass the value
Since most of the samples I am working on are related to SQL Server, I need to use the SqlParameter. There are various ways to pass the values from asp.net (or win forms, WPF applications, win service, etc...) applications. I prefer just create a new parameter by specifying its name and type while initializing and then pass the value using the value parameter.
Stored procedures which are accepting the parameters have to specify its datatype and the length of the data. If you are expecting that there will be a possibility that the parameter may not be passed at all i.e. the opt ...