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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. getting RecordCount = -1

getting RecordCount = -1

Scheduled Pinned Locked Moved Web Development
sharepointsysadminhelp
2 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.
  • A Offline
    A Offline
    Ankur Bakliwal
    wrote on last edited by
    #1

    Hello Friends, I have a problem with recordsets. I m getting Rs.RecordCount = -1 while calling a store procedures here is code - Set cmd = Server.CreateObject("ADODB.Command") Set rs = Server.CreateObject("ADODB.RecordSet") cmd.ActiveConnection = myCon cmd.CommandText = "SP_Name" cmd.CommandType = 4 cmd.CommandTimeout = 300 cmd.Parameters.Append cmd.CreateParameter("@par1",20,1,10,1) cmd.Parameters.Append cmd.CreateParameter("@par2",20,1,10,1) cmd.Parameters.Append cmd.CreateParameter("@par3",20,1,10,20) cmd.Parameters.Append cmd.CreateParameter("@par4",20,1,10,Null) Rs.CursorLocation = 3 Rs.LockType = 1 Rs.CursorType = 3 Set Rs = cmd.Execute Response.Write "
    RecordCount = " & Rs.RecordCount pls give some usefull solution. Thanks, Ankur Bakliwal

    A 1 Reply Last reply
    0
    • A Ankur Bakliwal

      Hello Friends, I have a problem with recordsets. I m getting Rs.RecordCount = -1 while calling a store procedures here is code - Set cmd = Server.CreateObject("ADODB.Command") Set rs = Server.CreateObject("ADODB.RecordSet") cmd.ActiveConnection = myCon cmd.CommandText = "SP_Name" cmd.CommandType = 4 cmd.CommandTimeout = 300 cmd.Parameters.Append cmd.CreateParameter("@par1",20,1,10,1) cmd.Parameters.Append cmd.CreateParameter("@par2",20,1,10,1) cmd.Parameters.Append cmd.CreateParameter("@par3",20,1,10,20) cmd.Parameters.Append cmd.CreateParameter("@par4",20,1,10,Null) Rs.CursorLocation = 3 Rs.LockType = 1 Rs.CursorType = 3 Set Rs = cmd.Execute Response.Write "
      RecordCount = " & Rs.RecordCount pls give some usefull solution. Thanks, Ankur Bakliwal

      A Offline
      A Offline
      andyharman
      wrote on last edited by
      #2

      The -1 means the database driver does not support record-counts for record sets. A quick way of achieving a record count is to use the recordset GetRows() method to extract the data into a two-dimensional array. Then you can do Ubound(arr, 2) to get the number of elements in the 2nd dimension. Regards Andy

      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