Click here to Skip to main content
16,018,353 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to Get in Listview Item Name Wise Qty Total


i Have an Listview Like

SrNo |Item Name Batch No Qty
1 A1 Fsd 10
2 A2 V 10
3 A3 D 10
4 A4 R 10
5 A1 T 10
6 A4 V 10
7 A2 C 10
8 A3 E 10
9 A1 Vc 10
10 A2 G 10
11 A3 H 10
12 A4 D 10
13 A4 N 10



How To Get
Item Name TotalQty
A1 30
A2 30
A3 30
A4 40

How To Above Type Total in vb.net
Posted

1 solution

Using a simple SELECT query, you could achieve that. I'm not going to give exact query but you could change based on your table structures.
--------------------
ItemID ItemName Qty
--------------------
     1 Item1     10
     2 Item2     10
     3 Item3     10
     4 Item4     10
     1 Item1     20
     2 Item2     20
     3 Item3     20
     4 Item4     20
     1 Item1     30
     2 Item2     30
     3 Item3     30
     4 Item4     30
--------------------

Sample query to get SUM of all items is below
SQL
SELECT ItemName, SUM(Qty) FROM TableName GROUP BY ItemName

Result is here
--------------------
ItemName Qty
--------------------
Item1     60
Item2     60
Item3     60
Item4     60
--------------------

Bind this values to your Listview. Now customize this for your requirement.

And you need to spend more time on learnings.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900