I'm trying to pull records from a table (with join) where a text field PassFail must not = PASS not be null/empty but I'm struggling with the syntax. The errors I have had so far point to the syntax I'm using is not supported by linq..
My latest attempt is
Dim HW2Process = (From mi In dc.tblMainDatas
Join u In dc.tblUsers On u.UserNo Equals mi.RecdBy
Join fi In dc.tblHWs On fi.HWRef Equals mi.HWRef
Where mi.Ref.StartsWith(tb_HWRefFind.Text.Trim()) And mi.DateProcessed.HasValue = True And ((mi.PassFail <> "PASS") And (IsNothing(mi.PassFail) = False))
Select New With {.ID = mi.ID,
.DateReceived = mi.DateRecd,
.ReceivedBy = u.FullName,
.SerialID = mi.SerialID,
.LiveTest = mi.LiveTest,
.DeployYear = mi. DeployYear,
.ProductType = mi.ProductType,
.HWRef = mi.HWRef,
.HWName = fi.HWName,
.MediaType = mi.MediaType,
.MediaQuantity = mi.MediaQty})
The criteria should be that mi.PassFail should not be null or empty or equal 'PASS'
Any help appreciated.
You write:
mi.DateProcessed.HasValue = True
Linq2SQL don't have right translation for this. You should write like this:
(Not (mi.DateProcessed Is Nothing))
I suppose same thing here:
(IsNothing(mi.PassFail) = False))
If you want translation of what i see here should be:
(Not (mi.PassFail Is Nothing))
I'm not really in VB, main in C# but i think you get this error becouse if you want to check some value on null you should do it like i mension.