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. Visual Basic
  4. count number of rows in table

count number of rows in table

Scheduled Pinned Locked Moved Visual Basic
database
5 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.
  • P Offline
    P Offline
    peteyshrew
    wrote on last edited by
    #1

    can anyone tell me the sql command for counting number of entries in a table and displaying as integer in textbox

    K 1 Reply Last reply
    0
    • P peteyshrew

      can anyone tell me the sql command for counting number of entries in a table and displaying as integer in textbox

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      select count(*) from tablename Hope that helps. Ben

      P 1 Reply Last reply
      0
      • K kubben

        select count(*) from tablename Hope that helps. Ben

        P Offline
        P Offline
        peteyshrew
        wrote on last edited by
        #3

        thanks that helped a lot. can you also help me with this similar query too. i need to do the same query but search only for entries where in one of the columns there is the letter f as appose to m. but i cant use a text box to enter the f. this is what i got but gives me the same answer as 'select count(*) from tablename "Select count(*) from Pupils where Sex LIKE '%" & F & "'" cheers

        P D 2 Replies Last reply
        0
        • P peteyshrew

          thanks that helped a lot. can you also help me with this similar query too. i need to do the same query but search only for entries where in one of the columns there is the letter f as appose to m. but i cant use a text box to enter the f. this is what i got but gives me the same answer as 'select count(*) from tablename "Select count(*) from Pupils where Sex LIKE '%" & F & "'" cheers

          P Offline
          P Offline
          peteyshrew
          wrote on last edited by
          #4

          actually dont worry i worked it out for myself cheers lots:)

          1 Reply Last reply
          0
          • P peteyshrew

            thanks that helped a lot. can you also help me with this similar query too. i need to do the same query but search only for entries where in one of the columns there is the letter f as appose to m. but i cant use a text box to enter the f. this is what i got but gives me the same answer as 'select count(*) from tablename "Select count(*) from Pupils where Sex LIKE '%" & F & "'" cheers

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            This depends on the datatype of the "Sex" column and what data is in it. What you have will work, so long as the column is one of the character types and only contains F or M. If there are spaces in the data or other garbage that shouldn't be there, your query is going to have a difficult time picking out the correct rows. Provided the table was setup correctly and the data was validated before it was written to the table, something like this should work:

            SELECT COUNT(Sex) FROM Pupils WHERE Sex='F'
            

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            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