使用LINQ to SQL,如何确定列中的所有值是否为空,以便我可以基于此触发某个操作?
我有一个程序部分可以将整个项目分配或取消分配给设计人员,或者我可以将项目分解为较小的货件并单独分配/取消分配。我有两个不同的表显示未分配的项目,另一个显示未分配的货物。如果所有货物都已单独取消分配,我需要弄清楚如何让项目显示在未分配的项目表上。
我尝试过的是......
If Not IsNothing(dgvAssignments.SelectedItem) Then
Dim Count As Integer
Dim DesignerNull As Integer
SelectedProjectID = dgvAssignments.SelectedItem.ProjectID
SelectedShipID = dgvAssignments.SelectedItem.Id
Count = (From Shipment In db.Shipments
Where Shipment.ProjectID = SelectedProjectID
Select Shipment.ID).Count
For i As Integer = 0 To Count - 1
DesignerNull = (From Shipment In db.Shipments
Where Shipment.ProjectID = SelectedProjectID
Select Shipment.DesignerID).ToList(i)
Next
Do Until DesignerNull <> Nothing
Dim UpdateProjectDesigner = (From Project In db.Projects
Where Project.ID = SelectedProjectID
Select Project)
For Each Project As Project In UpdateProjectDesigner
Project.DesignerID = Nothing
Next
Loop
End If