LINQ in label

  • Thread starter Thread starter gordigor
  • Start date Start date
G

gordigor

This is probably going to be an easy answer, but I can't find it anywhere. I
want to assign a labels .text property to a field returned in a LINQ Query:
Dim db As New ClientDataContext

Dim ColumnHeaders = From C In db.Customer _
Select _
C.Name

//I would expect assignment to work like this but Name doesn't show
Label.Text = ColumnHeaders.Name

What's the correct way?
 
gordigor said:
This is probably going to be an easy answer, but I can't find it
anywhere. I want to assign a labels .text property to a field returned
in a LINQ Query:
Dim db As New ClientDataContext

Dim ColumnHeaders = From C In db.Customer _
Select _
C.Name

//I would expect assignment to work like this but Name doesn't show
Label.Text = ColumnHeaders.Name

What's the correct way?

There doesn't seem to be any reason to use LINQ at all?

Why not simply something like:

Label.Text = db.Customer.First().Name
 
Göran Andersson said:
There doesn't seem to be any reason to use LINQ at all?

Why not simply something like:

Label.Text = db.Customer.First().Name

Ok. I was confused. Still I don't see the actual fields if I do Label.Text =
db.Customer
 
Back
Top