我正在使用SqlHelper
來執行DB中的存儲過程。將數據集轉換爲IList
在一個命名空間稱爲常量我定義是這樣的
public class ShowInstitutes
{
public string InstituteName { get; set; }
public string InstituteCity { get; set; }
public int InstituteId { get; set; }
}
在DAL層我想在IList
格式執行存儲過程和得到的結果
public IList<ShowInstitutes> ShowInstitutes(int instituteId)
{
return SqlHelper.ExecuteDataset(dBConnection, "usp_SPName");
}
我正在以下錯誤:
Cannot implicitly convert type 'System.Data.DataSet' to 'System.Collections.Generic.IList<>
我不知道,如果你能做到這一點。試試這個帖子:http://stackoverflow.com/questions/17107220/convert-dataset-to-object-list –