Apr 28th, 2012, 07:48 PM
how to display select count result in listview
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)
A success 120
A failed 30
B success 110
B failed 20
C success 120
C failed 30
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
Set list = ListView1.ListItems.Add(, , File)
list.SubItems(1) = branches
list.SubItems(2) = status
Apr 28th, 2012, 11:33 PM
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:
Now the resultset would have an additional field named "cnt" which would contain the count.
...status, COUNT(*) AS cnt from mytable...
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,...
Click Here to Expand Forum to Full Width
Survey posted by VBForums.