我正在測試編譯查詢的第一次。LINQ編譯的查詢將不會執行 - ArgumentNulException未處理
我當前的查詢是:
Shared compiledLatestDate As Func(Of RackJobbingDataDataContext, ArtikelInfoParameters, List(Of VerdelingPlanning)) = _
CompiledQuery.Compile(Of RackJobbingDataDataContext, ArtikelInfoParameters, List(Of VerdelingPlanning))(_
Function(db As RackJobbingDataDataContext, param As ArtikelInfoParameters) _
(From verdplan As VerdelingPlanning In db.VerdelingPlannings _
Join artPlan As ArtikelPlanning In db.ArtikelPlannings _
On artPlan.VerdelingPlanningID Equals verdplan.VerdelingPlanningID _
Join levDet As LeveringDetail In db.LeveringDetails _
On levDet.ArtikelPlanningID Equals artPlan.ArtikelPlanningID _
Join lev As Levering In db.Leverings _
On lev.LeveringID Equals levDet.LeveringID _
Where artPlan.ArtikelID.Equals(param.artId) _
And lev.WinkelID.Equals(param.winkId) _
And Not levDet.PlanningAantal.Equals(Nothing) _
And levDet.PlanningAantal <> 0 _
And verdplan.Datum < param.datumVerdeling _
Order By verdplan.Datum Descending _
Select levDet))
但是我收到一個ArgumentNulException了未處理。
委員會獲悉了LINQ查詢與所需的參數添加對象,所以這是類:
Public Class ArtikelInfoParameters
Private _wkId As Guid
Private _artId As Guid
Private _datumVerdeling As DateTime
Public Sub New(ByVal artId As Guid, ByVal winkId As Guid, ByVal datumVerdeling As DateTime)
_artId = artId
_wkId = winkId
_datumVerdeling = datumVerdeling
End Sub
Public Property artId As Guid
Get
Return _artId
End Get
Set(ByVal value As Guid)
_artId = value
End Set
End Property
Public Property winkId As Guid
Get
Return _wkId
End Get
Set(ByVal value As Guid)
_wkId = value
End Set
End Property
Public Property datumVerdeling As DateTime
Get
Return _datumVerdeling
End Get
Set(ByVal value As DateTime)
_datumVerdeling = value
End Set
End Property
End Class
而對於被完整的緣故,這是我收到的錯誤。
bij System.Data.Linq.SqlClient.SqlJoin.set_Left(SqlSource value)
bij System.Data.Linq.SqlClient.SqlMultiplexer.Visitor.VisitMultiset(SqlSubSelect sms)
bij System.Data.Linq.SqlClient.SqlVisitor.VisitSubSelect(SqlSubSelect ss)
bij System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
bij System.Data.Linq.SqlClient.SqlVisitor.VisitExpression(SqlExpression exp)
bij System.Data.Linq.SqlClient.SqlMultiplexer.Visitor.VisitSelect(SqlSelect select)
bij System.Data.Linq.SqlClient.SqlVisitor.Visit(SqlNode node)
bij System.Data.Linq.SqlClient.SqlProvider.BuildQuery(ResultShape resultShape, Type resultType, SqlNode node, ReadOnlyCollection`1 parentParameters, SqlNodeAnnotations annotations)
bij System.Data.Linq.SqlClient.SqlProvider.BuildQuery(Expression query, SqlNodeAnnotations annotations)
bij System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Compile(Expression query)
bij System.Data.Linq.CompiledQuery.ExecuteQuery(DataContext context, Object[] args)
bij System.Data.Linq.CompiledQuery.Invoke[TArg0,TArg1,TResult](TArg0 arg0, TArg1 arg1)
bij RackJobbing.UI.ucArtikelInfo.getLatestDate(Guid artikelId) in D:\EasySolutions\TFS\Provoost\Development\RackJobbing\RackJobbing.UI\Snelinvoer\Verdeling\ucArtikelInfo.vb:regel 69
bij RackJobbing.UI.ucArtikelInfo.UpdateInfo() in D:\EasySolutions\TFS\Provoost\Development\RackJobbing\RackJobbing.UI\Snelinvoer\Verdeling\ucArtikelInfo.vb:regel 111
bij RackJobbing.UI.frmPrePlanning.UcVerdeling1_ArtikelWinkelChanged() in D:\EasySolutions\TFS\Provoost\Development\RackJobbing\RackJobbing.UI\Snelinvoer\Verdeling\frmPrePlanning.vb:regel 280
bij RackJobbing.UI.ucVerdeling.grdVerdeling_EnterCell(Object sender, EventArgs e) in D:\EasySolutions\TFS\Provoost\Development\RackJobbing\RackJobbing.UI\Snelinvoer\Verdeling\ucVerdeling.vb:regel 339
bij C1.Win.C1FlexGrid.C1FlexGridBase.OnEnterCell(EventArgs e)
bij C1.Win.C1FlexGrid.C1FlexGridBase.a9()
bij C1.Win.C1FlexGrid.C1FlexGridBase.OnGridChanged(Object sender, GridChangedEventArgs e)
bij C1.Win.C1FlexGrid.C1FlexGrid.OnGridChanged(Object sender, GridChangedEventArgs e)
bij C1.Win.C1FlexGrid.t.bc(GridChangedTypeEnum A_0, Int32 A_1, Int32 A_2, Int32 A_3, Int32 A_4)
bij C1.Win.C1FlexGrid.t.bn(GridChangedTypeEnum A_0)
bij C1.Win.C1FlexGrid.p.n(C1FlexGridBase A_0, CellRange A_1, Boolean A_2)
bij C1.Win.C1FlexGrid.C1FlexGridBase.Select(CellRange rg, Boolean show)
bij C1.Win.C1FlexGrid.ab.o(MouseEventArgs A_0)
bij C1.Win.C1FlexGrid.ab.l(MouseEventArgs A_0)
bij C1.Win.C1FlexGrid.C1FlexGridBase.OnMouseDown(MouseEventArgs e)
bij System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
bij System.Windows.Forms.Control.WndProc(Message& m)
bij C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl.WndProc(Message& m)
bij System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bij System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bij System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bij System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bij System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bij System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bij System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bij System.Windows.Forms.Application.Run(ApplicationContext context)
bij Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
bij Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
bij Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
bij RackJobbing.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:regel 81
bij System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bij System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bij Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bij System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bij System.Threading.ThreadHelper.ThreadStart()
我會很感激在解決我的問題的任何幫助,因爲我真的似乎無法找到解決辦法:(
謝謝你的嘗試。但我仍然收到同樣的錯誤。 另外我必須承認,我從來沒有注意到它「使」有所不同:) – NicoJuicy 2011-02-07 16:39:14