Running a stored procedure in a SqlDataSource on button click

Posted by Gapton on Stack Overflow See other posts from Stack Overflow or by Gapton
Published on 2012-10-19T02:56:55Z Indexed on 2012/10/19 5:02 UTC
Read the original article Hit count: 201

I am building a C# ASP.NET page where I want to call a stored procedure in a database.

I have setup a SqlDataSource which points to the stored procedure. Parameters are obtained from the Web's control directly (TextBox)

I have a button, when the user clicks it it should run the stored procedure, so I was going to add code like this :

mySqlDataSource.run()

or

mySqlDataSource.exec()

or

mySqlDataSource.storedProcedure()

but of course none of these methods exist.

How do I initial the stored procedure? and how do I get the value returned by the stored procedure please?

Thank you!

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET