How do we provide parameters to the stored procedures?, DOT NET Programming

The ADO.NET gives the SqlCommand object which gives the functionality of executing the stored procedures.

CREATE PROCEDURE SelectByEmployee @FirstName nvarchar(200) AS

Select FirstName from Employees where FirstName like @FirstName + '%'


Select FirstName from Employees

If txtEmployeeName.Text.Length = 0 Then

objCommand = New SqlCommand("SelectEmployee")


objCommand = New SqlCommand("SelectByEmployee")

objCommand.Parameters.Add("@FirstName", Data.SqlDbType.NVarChar, 200)

objCommand.Parameters.Item("@FirstName").Value =


End if

In the sample above not much has been modified only that the SQL is moved to the stored procedures. There are 2 stored procedures one is "SelectEmployee" which selects all employees and the other is "SelectByEmployee" that returns employee name starting with the specific character. As you can see to give parameters to the stored procedures we are using the parameter object of the command object. In such type of question interviewer expects two simple answers one is that we use command object to execute the stored procedures and the parameter object to give  parameter to the stored procedure. The sample above is provided only for getting the actual feel of it.

Posted Date: 9/24/2012 2:40:48 AM | Location : United States

Related Discussions:- How do we provide parameters to the stored procedures?, Assignment Help, Ask Question on How do we provide parameters to the stored procedures?, Get Answer, Expert's Help, How do we provide parameters to the stored procedures? Discussions

Write discussion on How do we provide parameters to the stored procedures?
Your posts are moderated
Related Questions
Differentiate between managed and unmanaged code? Managed code is the code that is implemented directly by the CLR instead of the operating system. The code compiler first comp

Project Description:                                   Urgently require an expert with good knowledge of writing experience and UML diagrams. This project requires technologi

Your first assignment will require you to develop a record processing system in both ASP and PHP, giving you an opportunity to see two modern web scripting languages in action.

VB. Net & XML 1. Design a form based applications using labels, text boxes, and buttons to perform basic arithmetic operations on integers. 2. Explain the concept of Excepti

Jquery and MVC 4.5 Training Session I am looking who have industry experience working on Microsoft Technology ( MVC 4.5 ) and Jquery, who will take live online session and provi

What is the main difference between sub-procedure and function? The sub-procedure is a block of multiple visual basic statements within Sub and End Sub statements. It is used t

Printing and adding Fibonacci series - C# Program Hello guys i need your advice. How can i print and add Fibonacci series in my project. Please recommend some examples.

CRM and Shaerpoint We are using 365+ CRM in the cloud for QuattroCitta at the moment which we will migrate to our own private cloud in six months (project part 2). Within ShareP

Explain Forms authentication in detail. In the old ASP if you were said to create a login page and do authentication you have to do lot of custom coding. But now in ASP.NET tha

Could you please explain to me the different types of DOT NET programming