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

Answer Posted / narayansahu

create a connection object
create a command object like so
SqlCommand comm=new SqlCommand("storedprocname",conn)
comm.commandtype=cmmandtype.storedprocedure
and then add parameters like:
comm.parameters.addwithvale("@userid",textbox1.text)
comm.parameters.addwithvalue(@username",textbox2.text)
that's it

Is This Answer Correct ?    19 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum pool size in ado.net connection string?

703


What is sqldatareader?

677


What does ado stand for?

701


What is the return type of executescalar?

711


What do you know about ADO.NET's objects and methods?

728


What is the difference between ADO and ADO.Net?

820


How do you update a dataset in ado.net and how do you update database through dataset?

688


How to create data relations?

738


What is difference between executenonquery and executequery?

703


What are the disadvantages of using datalist?

702


What is difference between executequery and executeupdate?

703


Define atomicity?

796


What is ambient transaction?

688


Which method in OLEDBAdapter is used to populate dataset with records?

772


What are the classes in System.Data.Common Namespace?

890