Answer the question
In order to leave comments, you need to log in
How to unload from a table with several fields into a list and then extract this data from the list?
Good day. I apologize if the question was asked incorrectly.
It was necessary to extract certain fields from the table to the sheet, after this was done, it was necessary to display the data from the list (for example, to the console, which was done).
using (var bd = new WS2016Entities())
{
var dateUser = bd.User.AsEnumerable().Select(date => new User()
{
Email = date.Email,
Password = date.Password,
RoleId = date.RoleId
}).ToList();
}
Answer the question
In order to leave comments, you need to log in
The necessary data can be taken very simply - an anonymous object that contains all the necessary fields:
For example, get all EMail:
using (var db = new WS2016Entities())
{
var emails = db.User.Select(date => new { Email = date.Email }).ToList();
emails.ForEach(x => Console.WriteLine(x.Email));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question