Friday, December 22, 2006

Calling an Oracle Stored Proc from .NET


Well, this has worked far better than I could have expected. First I went into the TableAdapter for the Work_Stats table and added a query.

Of course, not all is perfect. As you can see, the stored procedure radio buttons are grayed out for some reason in the Table Adapter Query Wizard dialog, but we can work around that by kludging in a simple select query and then fixing the properties later.
Here, I've changed the CommandType from 'Text' to 'StoredProcedure' and chosen the correct SP from the dropdown that appears when you click on the CommandText line. In addition, since I expect a return value, I changed the Execute Mode to scalar. The parameters were all auto-sensed for me, so I didn't have to change anything.

No comments: