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

Command objects uses, purposes and their methods.

508


What does executereader return?

515


What are the advantages using ado.net?

529


How to maintain the relation between two tables in ADO.NET?

530


What is difference between datagridview and datagrid control in winforms?

505






Define executenonquery?

509


Can we load multiple tables in a dataset?

534


What is openquery?

521


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

534


Is it possible to load multiple tables in a Dataset?

517


Which database is the ado.net sql connection object designed for?

578


Name which operations can you not perform on an ado.net dataset?

477


What is serialization and de-serialization in .net? How can we serialize the dataset object?

508


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?

571


How to check if the Dataset has records ?

525