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

Assignment Help:

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 + '%'

CREATE PROCEDURE SelectEmployee AS

Select FirstName from Employees

If txtEmployeeName.Text.Length = 0 Then

objCommand = New SqlCommand("SelectEmployee")

Else

objCommand = New SqlCommand("SelectByEmployee")

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

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

txtEmployeeName.Text.Trim()

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.


Related Discussions:- How do we provide parameters to the stored procedures?

Sequence of uml diagrams in project, What is the sequence of UML diagrams i...

What is the sequence of UML diagrams in project? At First let me say some fact about this question, you cannot implement all the nine diagrams given by the UML in one project;

How can we get access to cache object?, The Cache object is always defined ...

The Cache object is always defined in the System.Web.Caching namespace. You can get the reference to the Cache object by either using the Cache property of the HttpContext class in

Query string and their benefits and limitations, What is Query String and w...

What is Query String and what are their benefits and limitations? The query string is the information sent to the server appended to the end of a page URL. The benefits of u

MySQL, deploying a mysql vb offline desktop application in new system that ...

deploying a mysql vb offline desktop application in new system that doesnot have any server or database created

Durkheims theory of crime, Application of durkheim''s theory of crime in ex...

Application of durkheim''s theory of crime in explaining the crime context in south Africa. Highlighting the relevance of the theory, as well as its limitations

What is the difference between vb6 and vb.net, What is the difference betwe...

What is the difference between VB6 and VB.Net? VB6 1.       It is Object-based Language 2.       It Does not support Threading 3.       Not powerful Exception handli

What are tuples, What are tuples? Tuple is a fixed-size collection that...

What are tuples? Tuple is a fixed-size collection that can have elements of either similar or different data types. Same to arrays, a user must have to specify the size of a tu

I need help in calendar integration into site using .net, I need help in Ca...

I need help in Calendar integration into site using .net I'm demanding to create a web-based proof of concept for the following scenario. I'd like to permit a user to select

Create a calculator application using web form, Create a Calculator applica...

Create a Calculator application using Web Form with the following functions: 1.  Add 2.  Minus 3.  Multiply 4.  Divide Each of the above has to be a Web Service

Extensible markup language (xml), What is XML? Extensible markup langua...

What is XML? Extensible markup language (XML) is all about describing the data. Below is a XML which describes an invoice data. Shoes   12 10

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd