I have a table that looks like this:
ID / Description / textValue / dateValue / timeValue / Type
1 / FRRSD / NULL / 2010-04-16 00:00:00.000 / NULL / classdates
Now I’ve got a LINQ command to pull only the rows where the type is classdates from this table:
Dim dbGetRegisterDates As New dcConfigDataContext
Dim getDates = (From p In dbGetRegisterDates.webConfigOptions _
Where p.Type = "classdates" _
Select p)
I now want to display the data in five different labels like so:
lblClass1.Text = "Your class is from " & getDates.Description("FRRSD").dateValue & "to " & getDates.Description("FRRCD").dateValue
lblClass2.Text = "Your class is from " & getDates.Description("SORSD").dateValue & "to " & getDates.Description("SORCD").dateValue
Basically, I want to pull a row based on the description column value and then return the datevalue column value from that same row.
I don’t know VB.NET syntax very well, so I’ll write it in C#, but you could create a Dictionary of descriptions to dates.
then you can do
You’ll probably want to do some checking that they exist too. Also, if the Description isn’t unique in the results, you’ll get an exception