Saturday, January 21, 2012


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 procedure

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 optional parameter, this can be easily defined in the stored procedure by assigning the null while declaring the parameters.
For more info please read here http://www.vbknowledgebase.com/?Id=152&Desc=Asp.Net-Stored-Procedure-Parameters

http://www.squidoo.com/guidance-on-choosing-a-used-car-


0 comments:

Post a Comment