我正在使用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 –