Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42340

VS 2010 Query results not fully populating

$
0
0
I have a query that checks to see if the quantity of an order exceeds the on-hand inventory. If so, the listbox should show the item, description, and the amount needed to order to meet the needs of the incoming orders. The end result should show 3 products that need to be ordered, but it is only showing 1 of the 3 for some reason. Here's the tables it is pulling from:

Attachment 96991

Here's the code I've come up with:
Code:

Dim query1 = From inventory In WAREHOUSEDataSet.Inventory
            Join orders In WAREHOUSEDataSet.Orders
            On inventory.itemID Equals orders.itemID
            Where (orders.itemID = inventory.itemID) And inventory.quantity - orders.quantity <= 0
            Let new_inv = orders.quantity - inventory.quantity
            Order By inventory.itemID Ascending
            Select inventory.itemID & "  " & new_inv & "  " & inventory.description
        lstOutput.Items.Clear()
        lstOutput.Items.Add("Here are the items that are out of")
        lstOutput.Items.Add("inventory or must be reordered.")
        lstOutput.Items.Add("")
        lstOutput.Items.Add("The numbers shown give the")
        lstOutput.Items.Add("minimum reorder quantity required.")
        lstOutput.Items.Add("")
        lstOutput.Items.AddRange(query1.ToArray)
        lstOutput.SelectedItem = Nothing

The above code returns each line of custom text and only the following entry:
SW934 5 T-Shirt Maker

It should return each line of custom text and all these entries:
SW101 2 Kurzwell VOICE for Win
SW109 0 MS Office Upgrade
SW934 5 T-Shirt Maker


Anyone able to figure out where I'm messing up? :blush:
Attached Images
 

Viewing all articles
Browse latest Browse all 42340

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>