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 is ado asp?

751


What is microsoft ado?

698


What is untyped dataset?

790


What is ole db and odbc?

698


how you will deal result set? How do you sort a dataset?If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?

782


Define different execute methods of ADO.NET command object ?

755


What is an ado?

733


Does ado.net use odbc?

703


What are the difference between readonly vs. Const?

699


Explain sqlconnection object?

762


What is sql connection in ado.net?

700


What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?

770


Which provider is used to connect ms access, oracle, etc…?

734


What is shadow copy?

759


What is disconnected architecture in ado.net?

727