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:
Posts (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...
-
Microsoft did a brilliant thing in SQL Server. I applaud them for this. You can actually pack more than one SQL Query into a stored proced...
-
Take a simple query something like this: select * from Orders where OrderID in (1724, 1722, 1710) order by OrderID desc In the course of usi...
-
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...