|Yes I did write this, I must of been on a roll. I understand what I wrote in TSQL, but I just can't wrap my head around how to write it in Linq.
DECLARE @startDate AS DATETIME, @stopDate AS DATETIME;
SET @startDate = DATETIMEFROMPARTS(@Year, @Month, @Day, 0, 0, 0, 0);
SET @stopDate = DATETIMEFROMPARTS(@Year, @Month, @Day, 23, 59, 59, 999);
FROM ShoppingCart sc
LEFT JOIN PRODUCTINFO pi ON sc.PartNumber = pi.PartNumber
WHERE sc.Date > @startDate
AND sc.Date < @stopDate
ORDER BY Date
Now I wrote this earlier as pResults = from Shopping cart with a join to products, so I can get the productID from products based on partNumber.
But the join or something was inconsistent according to the error. I was running 2 context. I put the product and cart tables in separate context.
So I was thinking perhaps I need to grab the Shopping cart data first, and then query those results with a join to products for the productID.
I have no clue how to phrase this.
This is what I have so far
Dim pValue As Integer = 0
Dim DateStart As New Date(Now.Year, Now.Month, Now.Day, 0, 0, 0, 0)
Dim DateStop As New Date(Now.Year, Now.Month, Now.Day, 23, 59, 59, 0)
Dim productContext As New ProductContext()
Dim shoppingContext As New ShoppingCartContext()
Dim query = _
From sc In shoppingContext.ShoppingCart
Where sc.CartDate >= DateStart _
And sc.CartDate <= DateStop
In hindsight, I should of used the productID in the shoppingCart table.