![enter image description here](https://i.stack.imgur.com/8YsTp.png)
Я пытаюсь загрузить данные из базы данных в RichTextBox (как показано на рисунке) в моем проекте c # windows, используя Linq.
Iне знаю, правильно ли я делаю, потому что данные не загружаются в RichTextBox.Пожалуйста, помогите.
Вот как я пытаюсь это сделать:
string idNr = txtIdcardNr.Text.Trim();
var CheckIfIdCardExist = (from u in db.Customer
where u.IdentityCardNr == idNr
select u).FirstOrDefault();
if(CheckIfIdCardExist != null)
{
String template =
@"Date\t\t{0}
Notes\t\t{1}
Staff\t\t{2}
*********\t\t{3}";
var notes = (from u in db.CustomerNotes
join em in db.Employee on u.StaffId equals em.EmployeeId
where u.CustomerId == CheckIfIdCardExist.CustomerId
select new {
Date = u.NoteDate,
notes = u.Notes,
employee = em.FirstName + " " + em.LastName
}).ToList();
foreach(var n in notes)
{
richTextBox1.Text = string.Format(template, n.Date, n.notes, n.employee);
}