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. Web Development
  3. recordcount property

recordcount property

Scheduled Pinned Locked Moved Web Development
databasesysadminquestion
5 Posts 2 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.
  • M Offline
    M Offline
    myousufq
    wrote on last edited by
    #1

    Hi there code below is working fine at my local server (PC) but when i m uploading this code to live server then recordcount property return -1... any solutions???? dim rsRandom,sqlRandom set rsRandom = Server.CreateObject("ADODB.Recordset") sqlRandom = "Some query" rsRandom.open sqlRandom,conn,3,3 response.write(rsRandom.recordCount) thanks in advance

    G M 2 Replies Last reply
    0
    • M myousufq

      Hi there code below is working fine at my local server (PC) but when i m uploading this code to live server then recordcount property return -1... any solutions???? dim rsRandom,sqlRandom set rsRandom = Server.CreateObject("ADODB.Recordset") sqlRandom = "Some query" rsRandom.open sqlRandom,conn,3,3 response.write(rsRandom.recordCount) thanks in advance

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      That means that the recordset doesn't support random access to the rows but only sequential access. The RecordCount property doesn't work as the recordset doesn't know how many records there are. It's probably because you use a different database driver on the live server.

      --- b { font-weight: normal; }

      M 1 Reply Last reply
      0
      • G Guffa

        That means that the recordset doesn't support random access to the rows but only sequential access. The RecordCount property doesn't work as the recordset doesn't know how many records there are. It's probably because you use a different database driver on the live server.

        --- b { font-weight: normal; }

        M Offline
        M Offline
        myousufq
        wrote on last edited by
        #3

        Hello Guffa thanks for your reply. Yes You are right. I m using MYSQL at live server. so wat a solution for this.. I mean how can i get recordcount when i use MYSQL.. thanks once again

        1 Reply Last reply
        0
        • M myousufq

          Hi there code below is working fine at my local server (PC) but when i m uploading this code to live server then recordcount property return -1... any solutions???? dim rsRandom,sqlRandom set rsRandom = Server.CreateObject("ADODB.Recordset") sqlRandom = "Some query" rsRandom.open sqlRandom,conn,3,3 response.write(rsRandom.recordCount) thanks in advance

          M Offline
          M Offline
          myousufq
          wrote on last edited by
          #4

          Thanks Guffa i got solution Function RecCount(rsdef) if rsdef.eof then RecCount = 0 else intRows = rsdef.GetRows rsdef.MoveFirst RecCount = UBound(intRows,2) + 1 end if End Function bye for now

          G 1 Reply Last reply
          0
          • M myousufq

            Thanks Guffa i got solution Function RecCount(rsdef) if rsdef.eof then RecCount = 0 else intRows = rsdef.GetRows rsdef.MoveFirst RecCount = UBound(intRows,2) + 1 end if End Function bye for now

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            So you only want to count the records? Then you shouldn't even fetch all the records, but count them in the database query and only return the number of records. Example:

            strSQL = "select count(*) from Users"
            objRS = objConnection.Execute(strSQL)
            lngCount = objRS(0)
            objRS.Close()
            Set objRS = Nothing

            --- b { font-weight: normal; }

            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