Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Get me a count....

Get me a count....

Scheduled Pinned Locked Moved The Weird and The Wonderful
toolsquestion
26 Posts 17 Posters 42 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Rob Manderson

    Check the MFC docs for CRecordset. They specifically advise that the record count isn't known until you've scrolled to the last record and then recommend you do just that if you need the count. A colleague, many years ago, followed that advice. It worked fine on his test databases but when it hit the real world and a recordset containing 3 million records it didn't work quite so well. Interestingly enough, the customer put up with the shocking performance (> 40 minutes for a form refresh). Go figure!

    Rob Manderson My bloghttp://robmanderson.blogspot.com[^]

    M Offline
    M Offline
    Mauro Leggieri
    wrote on last edited by
    #13

    Yes but it should not apply if the query uses "count(*)" becuase the sql server will do the "counting" and return 1 row with the result. Mauro Leggieri.

    1 Reply Last reply
    0
    • V Vikas Salvi

      I m really speechless on this.. string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count; ny comment??

      Vikas Salvi Programmer Analyst

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #14

      Did he use the wrong incantations?


      Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
      George Orwell, "Keep the Aspidistra Flying", Opening words

      K 1 Reply Last reply
      0
      • V Vikas Salvi

        I m really speechless on this.. string strQuery = "Select * from tblExtension where UserType = " + _UserType; int _Count = 0; OleDbDataReader drExtension = OleDbHelper.ExecuteReader(Utility.ConnectionString, CommandType.Text, strQuery); using(drExtension) { while(drExtension.Read()) { ++_Count; } } return _Count; ny comment??

        Vikas Salvi Programmer Analyst

        T Offline
        T Offline
        Ted Ferenc
        wrote on last edited by
        #15

        Reminds me of one I saw. To alphabetically sort the ASCII data in a table the moron read the relevant field into a fixed length string array and then he sorted the array. And guess what the management did to him? He was promoted to team leader eventually! I kid you not.


        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        R 1 Reply Last reply
        0
        • T Ted Ferenc

          Reminds me of one I saw. To alphabetically sort the ASCII data in a table the moron read the relevant field into a fixed length string array and then he sorted the array. And guess what the management did to him? He was promoted to team leader eventually! I kid you not.


          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #16

          Ted Ferenc wrote:

          And guess what the management did to him? He was promoted to team leader eventually!

          :wtf::omg:


          Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->ßRÅhmmÃ<-·´¯`·.

          T 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            Ted Ferenc wrote:

            And guess what the management did to him? He was promoted to team leader eventually!

            :wtf::omg:


            Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->ßRÅhmmÃ<-·´¯`·.

            T Offline
            T Offline
            Ted Ferenc
            wrote on last edited by
            #17

            The sad thing was the Software Manager, I was going to run a new branch the firm opened so they needed a team leader, my comment was make anybody team leader except him, even the cleaning lady would be a better choice. I did state that within 6 months he would have totally screwed up the work I had done in making the department function at least tolerably well. In 6 months I was proved correct, what happened to him? He left, as he was a team leader, he got a better team leaders job elsewhere!


            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for - in order to get to the job you need to pay for the clothes and the car, and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

            1 Reply Last reply
            0
            • D Dan Neely

              Rob Manderson wrote:

              Interestingly enough, the customer put up with the shocking performance (> 40 minutes for a form refresh). Go figure!

              Now that's the true WTF. :laugh:

              -- You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer

              S Offline
              S Offline
              StevenWalsh
              wrote on last edited by
              #18

              add a little spinny thing while it refreshes... they'll wait for hours :)

              1 Reply Last reply
              0
              • P PIEBALDconsult

                Well, yeah, but we have to save that for the next version... if anyone complains about performance that is. Or, if we're very lucky, we'll get to buy new servers to improve performance, and that makes us very happy. :-D

                C Offline
                C Offline
                Catalin Murariu
                wrote on last edited by
                #19

                The gay guy that rated your post with a 2, obviously didn't catch the sarcasm in it... Some things are too subtle I guess ;P

                Asynchronously daydreaming...

                1 Reply Last reply
                0
                • J jhwurmbach

                  Did he use the wrong incantations?


                  Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
                  George Orwell, "Keep the Aspidistra Flying", Opening words

                  K Offline
                  K Offline
                  KaRl
                  wrote on last edited by
                  #20

                  To get the count of items in your table, you would be using SQL's countof[^] (unless this is MySQL specific? :~)

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Well, yeah, but we have to save that for the next version... if anyone complains about performance that is. Or, if we're very lucky, we'll get to buy new servers to improve performance, and that makes us very happy. :-D

                    X Offline
                    X Offline
                    Xagyg
                    wrote on last edited by
                    #21

                    Gold Canyon, AZ ... where OpenSource means far too much of a reduction in profit margins! :)

                    P 1 Reply Last reply
                    0
                    • X Xagyg

                      Gold Canyon, AZ ... where OpenSource means far too much of a reduction in profit margins! :)

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #22

                      Alright, who are you and how do you know where I live? :~

                      X 1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        Alright, who are you and how do you know where I live? :~

                        X Offline
                        X Offline
                        Xagyg
                        wrote on last edited by
                        #23

                        http://profiles.yahoo.com/piebaldconsult

                        P 1 Reply Last reply
                        0
                        • X Xagyg

                          http://profiles.yahoo.com/piebaldconsult

                          P Offline
                          P Offline
                          PIEBALDconsult
                          wrote on last edited by
                          #24

                          Ah, yes. I do wish CP allowed more than simply "U.S.", it's a big damn country.

                          X 1 Reply Last reply
                          0
                          • P PIEBALDconsult

                            Ah, yes. I do wish CP allowed more than simply "U.S.", it's a big damn country.

                            X Offline
                            X Offline
                            Xagyg
                            wrote on last edited by
                            #25

                            I was just poking to find out where my next resume should go, if one needs to be sent out. :)

                            P 1 Reply Last reply
                            0
                            • X Xagyg

                              I was just poking to find out where my next resume should go, if one needs to be sent out. :)

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #26

                              We are looking to replace a developer who left recently.

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups