|
-
Apr 28th, 2012, 07:48 PM
#1
Thread Starter
New Member
how to display select count result in listview
hi,
there is branches such A,B,C etc. Customers get authorization at this branches and such failed,success result status in my sql table .
i want display this informations sending from database to listview using vb6.
how can i display sql count result in listview ? (total of records at 3.column)
for example;
A success 120
A failed 30
B success 110
B failed 20
C success 120
C failed 30
codes:
With rs.ActiveConnection = cn
.Open "select branches , status, COUNT(*) from mytable where date between '20120410 15:00:00' and '20120411 16:00:00' group by branches,status order by branches,status"
Dim branches,status As String
Do While Not rs.EOF
BRANCHES= rs("BRANCHES")
STATUS= rs("STATUS")
Set list = ListView1.ListItems.Add(, , File)
list.SubItems(1) = branches
list.SubItems(2) = status
rs.MoveNext
Loop
-
Apr 28th, 2012, 11:33 PM
#2
Re: how to display select count result in listview
Hi, Welcome to the forums..
Next time when you post your code fragments, enclose it like this:
[CODE]your code goes here[/CODE]
Regarding your question, maybe you could try it like this:
Code:
...status, COUNT(*) AS cnt from mytable...
Now the resultset would have an additional field named "cnt" which would contain the count.
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|