static void Main(string[] args) { DataAccess oDataAccess = new DataAccess(); oDataAccess.Provider = DataAccess.ProviderType.SQL; oDataAccess.ConnectionString = sConnString; // Paramaters collection object DataAccess.ProcedureParams oParams = new DataAccess.ProcedureParams(); oParams.sProcedureName = "bm_GetAppOverview"; // Create param objects and add to the collection DataAccess.Param oAppKey = new DataAccess.Param(); oAppKey.Direction = System.Data.ParameterDirection.Input; oAppKey.iSize = 0; oAppKey.sSrcColName = "AppKey"; oAppKey.value = 0; oParams.AddParam(oAppKey); // Call into the data access class & run the sproc DataSet oData = oDataAccess.ExecuteStoredProc(oParams); }Here's the ExecuteStoredProc code:
public DataSet ExecuteStoredProc(ProcedureParams oParams) { DataSet oDataSet = new DataSet();; IDbCommand oCommand = _GetCommand(oParams.sProcedureName); if (oCommand != null) { oCommand.CommandType = CommandType.StoredProcedure; foreach (Param oColParam in oParams.Params) { SqlParameter oParam = new SqlParameter(); oParam.DbType = oColParam.Type; oParam.Direction = oColParam.Direction; oParam.SourceColumn = oColParam.sSrcColName; oParam.Size = oColParam.iSize; oParam.Value = oColParam.value; oCommand.Parameters.Add(oParam); } IDbDataAdapter oAdapter = _GetDataAdapter(oParams.sProcedureName); if (oAdapter != null) { oAdapter.SelectCommand = oCommand; try { oAdapter.Fill(oDataSet); } catch (SqlException e) { // Removed for brevity } } } return oDataSet;I know the _GetCommand and _GetDataAdapter methods work because they are already in use elsewhere.