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 simple upgrades for asp.net site, I need Simple upgrades for ASP.NET...

I need Simple upgrades for ASP.NET site I have an existing web solution, we need a new page for creating additional features. The current website is done in C#.NET and ASP.NET.

What is common type system, What is "Common Type System" (CTS)?  CTS de...

What is "Common Type System" (CTS)?  CTS define all of the basic types that can be used  in the .NET Framework and the operations performed on those type. All this time we have

Develop soffware like speedscanner, Project Description: I am seeking a ...

Project Description: I am seeking a serious and motivated software developer that can create for me software like scanspeeder with all the functions as it has. Only thing that I

Use of hidden frames to cache client data, How can you use Hidden frames to...

How can you use Hidden frames to cache client data? This technique is implemented by developing a Hidden frame in page which will have your data to be cached. T cols="100

C# coding to include user specified screen recording to app, C# coding to i...

C# coding to include user specified screen recording to app Project Description: Reposting as selected coder didn't read brief and accepted job to do then tell me would be in

We need asp.net expert with simple html, We need Asp.net expert with simple...

We need Asp.net expert with simple html I am in search of a long term asp.net developer to build as well as maintain a volleyball player management website. We would like to inc

Explain some built-in functions of vbscript, Problem: (a) Explain the ...

Problem: (a) Explain the difference between these two lines of ASP codes: (b) The VBScript language includes some built-in functions which are often used in ASP co

Asp .net facebook app project completion, Asp .net Facebook app project com...

Asp .net Facebook app project completion Project Description: We are a small development house in Singapore, and have a project which is 90 percent complete; thus our previou

Various objects in dataset, What are the various objects in Dataset? Th...

What are the various objects in Dataset? The Dataset has a collection of DataTable object inside the Tables collection. Every DataTable object have  a collection of DataRow obj

Difference between datagrid, What's difference between Datagrid, Datalist a...

What's difference between Datagrid, Datalist and repeater? The Datalist ,Datagrid, and Repeater are all ASP.NET data Web controls. They have many things in common such as Da

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