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. General Programming
  3. C#
  4. count number of rows in query

count number of rows in query

Scheduled Pinned Locked Moved C#
databasequestion
3 Posts 3 Posters 0 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.
  • S Offline
    S Offline
    Stijn Goris
    wrote on last edited by
    #1

    Hi all, What is the easiest way to count the number of rows in a SQL query? I have been looking for a methode but wasn't able to find one?! regards Stijn

    S J 2 Replies Last reply
    0
    • S Stijn Goris

      Hi all, What is the easiest way to count the number of rows in a SQL query? I have been looking for a methode but wasn't able to find one?! regards Stijn

      S Offline
      S Offline
      sreejith ss nair
      wrote on last edited by
      #2

      If you are firing SQL queary ,then there is no way to get the number of rows get selected.Untile you collect the records in Dataset. Sreejith Nair [ My Articles ]

      1 Reply Last reply
      0
      • S Stijn Goris

        Hi all, What is the easiest way to count the number of rows in a SQL query? I have been looking for a methode but wasn't able to find one?! regards Stijn

        J Offline
        J Offline
        Jay Shankar
        wrote on last edited by
        #3

        do u want the number of records the query fetches. If yes, prepare the sql string like the one below

        Selcet Count(1) as RecordNum, col2, col3.... from table_name;

        here "Count(1) as RecordNum" will give you the number of rows. Regards, Jay

        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