tags:

views:

19

answers:

0

Hi,..

"Nullable object must have a value." I got this error when execute n get the result (the linq to sql command)

 Dim QSs = (From VM In cntxtVessel.VesselMasters _
                      Group Join cnt In cntxtVessel.CountryMasters On VM.CountryCode Equals cnt.CountryCode Into Cntry = Group _
                      From CM In Cntry.DefaultIfEmpty _
                      Group Join D In cntxtVessel.DestinationMasters On VM.DestinationCode Equals D.DestinationCode Into Dest = Group _
                      From DM In Dest.DefaultIfEmpty _
                     Group Join Car In cntxtVessel.CarrierMasters On VM.ClientCode Equals Car.CarrierCode Into Cr = Group _
                     From CS In Cr.DefaultIfEmpty _
                    Where VM.VesselCode = intVesselCode _
                    Order By VM.VesselName Ascending _
                    Select VesselCode = VM.VesselCode, VesselID = VM.VesselID, VesselName = VM.VesselName, ServiceType = VM.ServiceType, ClientCode = CType(CS.CarrierCode, Int32), Agent = CS.CompanyName, RefNo = VM.RefNo, VesselType = VM.VesselType, Length = VM.Lenght, Width = VM.Weight, Height = VM.Height, VesselBuiltDate = VM.VesselBuiltDate, AgeOfShip = VM.AgeOfShip, ShipBuilder = VM.ShipBuilder, CountryCode = CType(CM.CountryCode, Int32?), CountryName = CType(CM.CountryName, String), DestinationCode = CType(VM.DestinationCode, Int32?), DestinationName = DM.DestinationName, Flag = VM.Flag, CallSign = VM.CallSign, IMONo = VM.IMONo, NRT = VM.NRT, ContactPerson = VM.ContactPerson, MobileNo = VM.MobileNo, TPNo = VM.TPNo, Fax = VM.Fax, Email = VM.Email, Web = VM.Web, Remarks = VM.Remarks, InActive = VM.InActive).SingleOrDefault

grdVessel.Datasource=Qss