How do we use stored procedure in ADO.NET?

How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?

CREATE PROCEDURE RUPDATE (@RID INTEGER, @RDESC NCHAR(50))
AS
SET NOCOUNT OFF
UPDATE Region
SET RDESC = @RDESC

SqlCommand command = new SqlCommand("RUPDATE",con);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@RID",SqlDbType.Int,0,"RID"));
command.Parameters.Add(new SqlParameter("@RDESC",SqlDbType.NChar,50,"RDESC"));
command.Parameters[0].Value=4;
command.Parameters[1].Value="SouthEast";
int i=command.ExecuteNonQuery();

How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?

SqlCommand cmd1 = new SqlCommand("Employee", conn); Employee is the name of the stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@empID", empId));
Basic use of “DataView” and explain its methods.
A DataView is a representation of a full table or a small section of rows, it is used to sort and find data within Datatable...
Differences between DataSet and DataReader.
DataSet object can contain multiple rowsets from the same data source as well as from the relationships between them...
Explain how to load multiple tables in a DataSet
Load multiple tables in a DataSet using ADO.NET...
Post your comment