the adonet gives the sqlcommand object which


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.

Request for Solution File

Ask an Expert for Answer!!
DOT NET Programming: the adonet gives the sqlcommand object which
Reference No:- TGS0161346

Expected delivery within 24 Hours