Struggling with LINQ to Dataset
Hi,
I'm just getting my feet wet with LINQ but am struggling to convert this SQL statement to LINQ.
Code:
Dim SQLString As String = "SELECT MESSAGE_ID FROM " & Schema & _
".PPM_TRANSFER_EMAIL WHERE TO_CHAR(IMPORTED_DATE,'YYYY/MM/DD') <= '" & _
DeletionDate.ToString("yyyy/MM/dd") & "' AND IMPORTED = 'Y' AND FILE_NAME LIKE '" & _
mb & "%'"
I have a Dataset that already contains all the data from the PPM_TRANSFER_EMAIL table so it seems silly to query the database again when I can use LINQ to query the dataset. I just can't figure out the syntax.
Re: Struggling with LINQ to Dataset
should look something like this:
Code:
Dim MessageID_List As List(Of String) = yourdataset.datatablename.WHERE(function (c) c.Imported_Date <= DeletionDate andalso c.Imported = "Y" AndAlso c.File_Name.StartsWith(mb)).Select(function (f) f.Message_ID).ToList()
I think that will work....
-tg