Multiple fields from LINQ to Text Box
- by Chuki2
how can I pass value from selected field (LINQ) to textbox in winforms?
If single fields, I just do like this
var result = from row in dtValueBranch.AsEnumerable()
where row.Field<int>("branchID") == idBranch
select row.Field<string>("branchName");
StringBuilder sb = new StringBuilder();
foreach (string s in result)
{
sb.Append(s + Environment.NewLine);
}
tbBranch.Text = sb.ToString();
So this is the code LINQ to many fields
var result = from row in dtValueBranch.AsEnumerable()
where row.Field<int>("branchID") == idBranch
select new
{
BranchName = row["branchName"].ToString(),
branchTel = row["branchTel1"].ToString(),
// And many more fields
};
How can I to implement each fields to each textbox?