Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I get the return value when calling a stored procedure in a typed DataSet object?

0
Posted

How do I get the return value when calling a stored procedure in a typed DataSet object?

0

[top] A stored procedure is called as a method of a typed DataSet object. However, when you return a value from a stored procedure, you cannot get it directly. If you want to get the return value from a stored procedure, you must write a new method in the partial class of the generated TableAdapter object, like that shown in the following example. The input parameter is the index of the method in the TableAdapter instance; you can see this value in the design of a typed DataSet object. partial class UsersTableAdapter { public object GetReturnValue(int commandIndex) { return this.CommandCollection[commandIndex].Parameters[0].Value; } } You can then call the method to get the return value as shown in the following example: da.CallSP(xx, xx); int returnValue = int.Parse(da.GetReturnValue(2).ToString()); 1.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123