以下のようにリストを作成し、データリーダーからの値で更新しようとしています。データ リーダーからこのリストを更新するためのコードを書くのに助けが必要です。
internal IList<FilingDto> LoadStatusDtofromReader(IDataReader reader)
{
IList<FilingDto> filingstatus = new List<FilingDto>();
while (reader !=null && reader.Read())
{
var dto = new FilingDto();
var Year = (Decimal)reader["Year"];
dto = new FilingDto()
{
Controllerid = (Guid)reader["Collectorid"],
Status = DBNull.Value.Equals(reader["Status"]) ? string.Empty : reader["Status"].ToString(),
Year = Convert.ToInt32(Year),
Level = DBNull.Value.Equals(reader["Level"]) ? string.Empty : reader["ServiceLevel"].ToString()
};
filingstatus.Add(dto);
}
return status;
}
データリーダーから読み取るコードは次のとおりですが、間に詰まっています。これを完了するのを手伝ってください
DataTable FilingStatus = new DataTable("FilingStatus");
SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Connectionstring"].ConnectionString);
sqlcon.Open();
SqlCommand cmd = new SqlCommand("select Collectorid, Status, Year, Level from dbo.abc", sqlcon);
using (IDataReader dr =