protected virtual void DataPortal_Fetch(IdCriteria criteria) { using (IDataConnection connection = SimpleQuery.ConfigurationManagerConnection("")) { if (connection.State == ConnectionState.Closed) { connection.Open(); } using (IDataCommand command = new DataCommand((connection.CreateCommand()))) { command.CommandType = CommandType.StoredProcedure; command.CommandText = "Pricing.Owner#FetchByDealerId"; command.AddParameterWithValue("DealerId", DbType.Int32, false, criteria.Id); using (IDataReader reader = command.ExecuteReader()) { if (reader.Read()) { Fetch(reader); } else { throw new Exception("No such Owner!"); } } } } }