Ok, let's say you have a stored procedure that returns a value.
Now lets say you want to test it in SQL Server Management Studio...
This gives us a value of 1, as expected.
Now if we want to call this from C#, there is a little trick we have to play with Parameters.
Note the trick we had to play here (line 19) to access the return value after the procedure runs. At first, I tried using:
i=myCommand.ExecuteNonQuery();
...but that always yielded a value of -1.
Bryan Valencia is a contributing editor and founder of Visual Studio Journey. He owns and operates Software Services, a web design and hosting company in Manteca, California.
Subscribe to:
Post Comments (Atom)
How to Auto-generate Order Line Item numbers for bulk uploads
I had a problem where I had 17000 line items to insert into 9000 orders. The system required line item numbers, preferably numbered 1throug...
-
I had a problem where I had 17000 line items to insert into 9000 orders. The system required line item numbers, preferably numbered 1throug...
-
Ok I like organization. Too much perhaps. But when my project root folder gets full (Microsoft likes everything in there) I get tired of ...
-
This article explains how to copy a database from one server to another when Backup/Restore is not an option. This will work as long as...
No comments:
Post a Comment