How to be database specific w/o being database specific...

Topics: Data Access Application Block, General discussion
Apr 16, 2007 at 6:48 PM
Edited Apr 16, 2007 at 6:51 PM
When ever i want to return data from a oracle package(using cursors) I typically do the following:

 OracleCommand cmdChartData = new OracleCommand("pkg_name.prc_name",
OracleConnection("conn string"));
      cmdChartData.CommandType = CommandType.StoredProcedure;
      cmdChartData.Parameters.Add("cur_name", OracleType.Cursor).Direction = ParameterDirection.Output;
      OracleDataAdapter daChartData = new OracleDataAdapter(cmdChartData);
      DataSet dsChartData = new DataSet();

I'm trying to use the DAB from EL 3.0 by doing the following:
  Database db = DatabaseFactory.CreateDatabase("oraconn");
      System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand("pkg_name.prc_name");
      db.AddOutParameter(dbCommand, "CUR_Name", DbType.Object, 0);
      OracleDatabase oradb = (OracleDatabase)DatabaseFactory.CreateDatabase("oraconn");
      DataSet ds = db.ExecuteDataSet(dbCommand);

the out parameter is not being built correctly and is telling me the out param is of the wrong type. Can somebody please point me the right way. TIA Brian