I don't know Vb, but something like: Dim resultA = From logItem in dc. Log Select logItem If (Not String. IsNullOrEmpty(searchText)) Then resultA = q.
Where(Function(logItem) logItem.Message. Contains(searchText)) resultA = from logItem in resultA Select logItem. LogID, logItem.
DateLogged I think that will still generate useful SQL.
That's right. You first query return IQueryable(Of T) where T is an anonymous type that does not contain Message. That's where your optional Where fails.
You can leave the Select for the end and you will get the result you want. – Lucas May 12 '09 at 13:13 Although, you'll need a new variable to hold the Select results, since they will be a differente type than resultA. – Lucas May 12 '09 at 13:14.
Thanks for your input Steven. Your suggestion got me thinking, and my final solution was based on this. However I found a way to reuse the same object by using a Lambda expression to specify a select at the end (in the same way as the where statements): q = q.
Select(Function(logItem) New Log With {. LogID = logItem. LogID, .
DateLogged = logItem. DateLogged}.
Select(x=>new Entity{col1 = x. Col1, col4 = x. Col4, col5 = x.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.