Call a stored procedure from ado.net and pass parameter to it ?

Answer Posted / vagdevi

By using the SQLHelper of Microsoft,
in Business Layer import Microsoft.ApplicationBlocks.Data
and then,
Create properties for the parameters as userid,password
Declare a parameter array of Type SqlParameter as,

SqlParameter[] p=new SqlParameter[2];

p[0]=new SqlParameter("@userid",userid");
p[0].DbType=DbType.String;
p[0].Direction=ParameterDirection.Input;

p[1]=new SqlParameter("@password",password");
p[1].DbType=DbType.String;
p[1].Direction=ParameterDirection.Input;

SqlHelper.ExecuteNonQuery
(ConnetionString,CommandType.StoredProcedure,"StoredProcedur
eName", p);

That's it and call this method in your Presentation Layer

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the methods of XML dataset object?

611


Why do we use sqldataadapter?

479


Which database is the ado.net?

496


Explain the namespaces in which .net has the data functionality class.

531


How do you connect to sql server database without using sqlclient?

558






What is the difference between executenonquery () and executescalar ()?

486


How to connect and retrieve data from database using dataset

536


What is bubbled event can you please explain?

525


What is connection in ado.net?

527


Which one of the objects is a high-level abstraction of the connection and command objects in ado.net?

631


How would you connect to a database by using .NET?

475


What is dataset and datatable in ado.net?

501


Describe the disconnected architecture of ADO.NET’s data access model.

538


What is ado.net objects?

521


What is ado.net code?

520