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?

I need ninjatrader strategy, I need Ninjatrader Strategy Project Descrip...

I need Ninjatrader Strategy Project Description: UI for managing orders, entering trades. This project will probably take several months and I need dedicated resources. Sk

SMS APPLICATION WITH AUTO REPLY, I want to develop SMS application with aut...

I want to develop SMS application with auto reply based on the content of the message using gsm modem. eg.Student results checking using cell phone via sms. How do i do this?

What is a parameter, What is a parameter? Explain the new types of paramete...

What is a parameter? Explain the new types of parameters introduced in C# 4.0. A parameter is a special type of variable, which is used in a function to give a piece of informa

What is plinq, What is PLINQ? PLINQ stands for Parallel Language Integr...

What is PLINQ? PLINQ stands for Parallel Language Integrated Query. It is the parallel execution of LINQ, in which a query can be implemented by using multiple processors. PLIN

Task on data mining, Task on data mining Project Description: Task on...

Task on data mining Project Description: Task on Opinion Mining, Sentiment Analysis Skills required are C# Programming, Software Architecture, Data Mining

Script for auto seating poker, Script for auto seating poker Project Des...

Script for auto seating poker Project Description: Not just like that though. I need a similar program that can scan during poker lobbys (pokerstars, ipoker, full tilt and on

Title..case statement, Design an interface and add code to command buttons ...

Design an interface and add code to command buttons using case statement, to find coursework to be calculated using formula 0.6*1/6*total Mark

Various types of transactions in com + .net, Types of Transactions in COM +...

Types of Transactions in COM + .NET There are 5 types of transactions that can be used with COM+.   An object is whenever registered with the COM+ it has to abide either to any

I need a project which shows paypal integration with asp.net, I need a proj...

I need a project which shows Paypal integration with ASP.net website We have events website written in C# and ASP.net. We want to integrate Paypal using API and have a full inte

Monitor object, What is a monitor object? Monitor objects are used to e...

What is a monitor object? Monitor objects are used to ensure that a block of code runs without being interrupted by code running on other threads. In other words, code in other

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