Problem Function The
following is the function I am having problems with. I keep getting the error "sequence contains more than one element". That's what it is. However, I am not sure how to return the information so that I can use it. Any help would be greatly appreciated.
EditCountyViewModelis a small class containing the public County countyCountyList . I have also tried changing the Read<> toRead` public list , which is the base class for all my county information.
public EditCountyViewModel FindByCounty(string countyName)
{
var parameters = new DynamicParameters();
parameters.Add("@CountyName", value: countyName);
var query = @"SELECT counties.id
, counties.CountyName
, counties.Website
, counties.Address
, counties.City
, counties.State
, counties.PhonePrimary
, counties.PhoneAlt
, counties.RecordsOnline
, counties.BackToYear
, counties.Cost
, products.ProductName
, products.Description
, countyproduct.TurnTime_MinHours
, countyproduct.TurnTime_MaxHours
, countyproduct.Price
FROM
counties, countyproduct, products
WHERE
counties.CountyName = @CountyName AND countyproduct.countiesID = countyproduct.countiesID AND countyproduct.productsID = products.ID;";
return this.db.Query<EditCountyViewModel>(query, parameters).SingleOrDefault();
}
It seems to me that I need another class to handle the elements coming from the table countyproductand products.
source
share