SqlDataSource + ODP.NET + Stored procedures
525134Aug 1 2006 — edited Oct 16 2006I'm so extraordinarily close to getting this to work, but I just can't get the last step.
Here's the spec: Using a DataSource control, ODP.NET, and stored procedures for everything, I need to enable CRUD on a GridView.
The catch is that almost nothing can be written declaratively: The page I'm writing will serve CRUD operations on many different tables by reading in their columns and display data from an XML file, so everything has to be set dynamically at runtime. This also means that I can't use an ObjectDataSource, because that would require me to write insert/update methods which take the fields as parameters and I don't know what the fields will be until runtime.
After creating a new implementation of DbProviderFactory which sets BindByName on new DbCommands to true and surmounting all the issues associated with that (see http://blog.ljusberg.com/2005/11/custom-data-provider-continued.html), SqlDataSource has given me a working system which allows me to update and delete through my GridView and insert through a DetailsView all according to my spec.
Unfortunately--and herein lies my problem--<b>my SqlDataSource's SelectCommand doesn't work as a stored procedure</b>. The SqlDataSource doesn't know how to select from an Oracle stored procedure using ODP.NET because it doesn't know to add the SYS_REFCURSOR parameter and read in data from the cursor. I get an "ORA-06550: PLS-00306: wrong number or types of arguments" error, which makes sense, since the SqlDataSource leaves off my refcursor argument.
If only I could extend OracleCommand, I could fix this problem easily. I tried extending SqlDataSource but couldn't get anywhere. And now I'm stuck.
There must be a way around this. Does someone know what I need to do?
Thanks a lot,
-Justin