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?

How does authorization work in asp.net ?, The ASP.NET impersonation is tota...

The ASP.NET impersonation is totally controlled by entries in the applications web.config file. Default setting is "no impersonation". You can explicitly describe  that ASP.NET sho

Simple task on analysis svn and github, Project Description: Simple task...

Project Description: Simple task on analysis svn and github .NET, PHP, Engineering, Software Architecture

I need c# aac sound receiver over wcf, I need C# AAC sound receiver over WC...

I need C# AAC sound receiver over WCF Project Description: I want a WCF method which is able to receive a byte stream of an AAC sound file from iPhone device and save it on t

Udp based data transfer client-server in .net, UDP Based, Data Transfer Ser...

UDP Based, Data Transfer Server/ Client in .NET C# Project Description: We require the Network Level Functionalities (NLFs) of a Server/ Client for transferring data among tw

Can we run dot.net in unix platform, Can we run DOT.NET in UNIX platform? ...

Can we run DOT.NET in UNIX platform? One of the drawbacks of using Visual Studio.NET and the .NET framework to develop applications has been the lack of cross-platform support.

Name the binders provided by .net framework 4.0, Name the binders provided ...

Name the binders provided by .NET Framework 4.0. .NET Framework 4.0 provides the following binders: Object Binder - Enables to communicate with .NET objects. JavaScrip

Mvc and c# single page application, MVC -C# Single Page Application Proj...

MVC -C# Single Page Application Project Description: Construct a site similar to prototype: To explain briefly: 1) Single Page Application 2) Loginig funcionality

What is a cloud service, What is a Cloud Service? A cloud service is us...

What is a Cloud Service? A cloud service is used to build cloud applications. This service gives the facility of using the cloud application without installing it on the comput

Case statement, Design the following interface and add code to the command ...

Design the following interface and add code to the command buttons to achieve the following using case statement. I) find coursework to be calculated using the following formula:-0

Immediate need in website update, Website update... Immediate need I wan...

Website update... Immediate need I want someone experienced in ASP.NET who can set up PayPal on my website by Feb. 1st. I would similarly like to have some changes made in the t

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