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

Which is faster sqldataadapter and sqldatareader?

479


What is ado oledb and odbc?

482


What is DataReader Object?

576


What is the DataTableCollection?

551


What is commandbuilder in ado.net?

506






What is the difference between DataReader and DataSet in ADO.NET?

573


Explain why edit is not possible in repeater?

517


What is ado in agriculture?

495


If a table contains 20000 records . In a page at each time 100 records to be displayed what are the steps you will take to improve performance? Will you use dataset or datareader?

592


How to aggregating data across related tables?

533


What does ado stand for in ado.net?

438


What are all the different authentication techniques used to connect to MS SQL Server?

519


List the 4 common ado.net namespaces?

677


What is sqlconnection and sqlcommand?

499


Which is better entity framework or ado.net?

493