Results 1 to 2 of 2
  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2012

    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)
    for example;
    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

    STATUS= rs("STATUS")

    Set list = ListView1.ListItems.Add(, , File)
    list.SubItems(1) = branches
    list.SubItems(2) = status


  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Trivandrum, Kerala, India

    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:
    ...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


Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.