CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    4

    "Select Count(*) ..." in ADO

    How do I get the result of "Select Count(*) From MyTable"
    in ADO? My program environment is VC6.0.
    which ADO object (i.e. connection, command, etc) to use and
    which method?

    Thanks,
    Vanessa Li

    Vanessa Li

  2. #2
    Join Date
    Apr 1999
    Posts
    27

    Re: "Select Count(*) ..." in ADO

    If you want to use the GetCollect method of a recordset you can do this. Change the SQL to SELECT COUNT(*) FROM table AS total_count. Then use the getcollect method:

    _variant_t Holder = MySet->GetCollect("total_count");

    Holder.ival will have your value in it.

    Bob


  3. #3
    Join Date
    Apr 1999
    Location
    Philippines
    Posts
    46

    Re: "Select Count(*) ..." in ADO

    Good Day!
    How should I declare the "total_count", should it be a field in my table?
    or is it automatically created temporarily at runtime?
    TIA


  4. #4
    Join Date
    Apr 1999
    Posts
    27

    Re: "Select Count(*) ..." in ADO

    It is automaticly sreated in the returned recordset. If you go to MSQuery (or any other tool) and type the SQL in, you will see it listed as a column name.

    bob


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

Featured