DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 10 of 10

Thread: RecordCount is -1 Why?

  1. #1
    John K. Guest

    RecordCount is -1 Why?

    rs.recordcount is -1
    why??

    I know there are five records in the recordset,
    but the recordcount property still is -1.

    Any suggestions?

    Thanks!

    --
    John Knoop . john.k@home.se
    ~~~~~~~~~~~~~~~~~~~~~~~



  2. #2
    T. Bradley Dean Guest

    Re: RecordCount is -1 Why?

    Before getting the .RecordCount, do .MoveLast.


    John K. <john.k@home.se> wrote in message news:39495565$1@news.devx.com...
    >




  3. #3
    John K. Guest

    Re: RecordCount is -1 Why?

    OK, thanks!

    "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    news:394957a4$1@news.devx.com...
    > Before getting the .RecordCount, do .MoveLast.
    >
    >
    > John K. <john.k@home.se> wrote in message news:39495565$1@news.devx.com...
    > >

    >
    >




  4. #4
    John K. Guest

    Re: RecordCount is -1 Why?

    Ok, I tried your suggestion,
    but now get the error:
    Rowset does not support fetching backward.

    Why?

    Thanks!

    "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    news:394957a4$1@news.devx.com...
    > Before getting the .RecordCount, do .MoveLast.
    >
    >
    > John K. <john.k@home.se> wrote in message news:39495565$1@news.devx.com...
    > >

    >
    >




  5. #5
    T. Bradley Dean Guest

    Re: RecordCount is -1 Why?

    It sounds like you are opening the table as a forward only recordset, and
    then going backwards after using the .movelast. Are you using ADO or DAO?
    Can you post the code you are using, from when you open the table to when
    you get the error.

    John K. <john.k@home.se> wrote in message news:3949712e@news.devx.com...
    > Ok, I tried your suggestion,
    > but now get the error:
    > Rowset does not support fetching backward.
    >
    > Why?
    >
    > Thanks!
    >
    > "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    > news:394957a4$1@news.devx.com...
    > > Before getting the .RecordCount, do .MoveLast.
    > >
    > >
    > > John K. <john.k@home.se> wrote in message

    news:39495565$1@news.devx.com...
    > > >

    > >
    > >

    >
    >




  6. #6
    John K. Guest

    Re: RecordCount is -1 Why?

    I am using ADO, and here's the code:

    <%
    dim nCount
    set dbc = server.createobject("ADODB.Connection")
    set rs = server.createobject("ADODB.Recordset")
    dbc.open "DSN=prono;UID=;PWD"
    SQL = "SELECT * FROM Artikel WHERE Text LIKE '%" &
    request.querystring("txtSearch") & "%' ORDER BY tid DESC"
    rs.open SQL, dbc
    rs.movelast
    %>
    ....
    <%=rs.recordcount%>

    A few lines down the page there is more code,
    but the error occurs on the "<%=rs.recordcount%>" line.

    Thanks!



    "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    news:3949743f$1@news.devx.com...
    > It sounds like you are opening the table as a forward only recordset, and
    > then going backwards after using the .movelast. Are you using ADO or DAO?
    > Can you post the code you are using, from when you open the table to when
    > you get the error.
    >
    > John K. <john.k@home.se> wrote in message news:3949712e@news.devx.com...
    > > Ok, I tried your suggestion,
    > > but now get the error:
    > > Rowset does not support fetching backward.
    > >
    > > Why?
    > >
    > > Thanks!
    > >
    > > "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    > > news:394957a4$1@news.devx.com...
    > > > Before getting the .RecordCount, do .MoveLast.
    > > >
    > > >
    > > > John K. <john.k@home.se> wrote in message

    > news:39495565$1@news.devx.com...
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >




  7. #7
    T. Bradley Dean Guest

    Re: RecordCount is -1 Why?

    You are opening the recordset as Forward Only,which is the default. Use this
    to open the recordset:

    rs.open SQL, dbc, adOpenKeyset


    John K. <john.k@home.se> wrote in message news:39497522@news.devx.com...
    > I am using ADO, and here's the code:
    >
    > <%
    > dim nCount
    > set dbc = server.createobject("ADODB.Connection")
    > set rs = server.createobject("ADODB.Recordset")
    > dbc.open "DSN=prono;UID=;PWD"
    > SQL = "SELECT * FROM Artikel WHERE Text LIKE '%" &
    > request.querystring("txtSearch") & "%' ORDER BY tid DESC"
    > rs.open SQL, dbc
    > rs.movelast
    > %>
    > ...
    > <%=rs.recordcount%>
    >
    > A few lines down the page there is more code,
    > but the error occurs on the "<%=rs.recordcount%>" line.
    >
    > Thanks!
    >
    >
    >
    > "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    > news:3949743f$1@news.devx.com...
    > > It sounds like you are opening the table as a forward only recordset,

    and
    > > then going backwards after using the .movelast. Are you using ADO or

    DAO?
    > > Can you post the code you are using, from when you open the table to

    when
    > > you get the error.
    > >
    > > John K. <john.k@home.se> wrote in message news:3949712e@news.devx.com...
    > > > Ok, I tried your suggestion,
    > > > but now get the error:
    > > > Rowset does not support fetching backward.
    > > >
    > > > Why?
    > > >
    > > > Thanks!
    > > >
    > > > "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    > > > news:394957a4$1@news.devx.com...
    > > > > Before getting the .RecordCount, do .MoveLast.
    > > > >
    > > > >
    > > > > John K. <john.k@home.se> wrote in message

    > > news:39495565$1@news.devx.com...
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >




  8. #8
    John K. Guest

    Re: RecordCount is -1 Why?

    I still get the error

    "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    news:39497c20@news.devx.com...
    > You are opening the recordset as Forward Only,which is the default. Use

    this
    > to open the recordset:
    >
    > rs.open SQL, dbc, adOpenKeyset
    >
    >
    > John K. <john.k@home.se> wrote in message news:39497522@news.devx.com...
    > > I am using ADO, and here's the code:
    > >
    > > <%
    > > dim nCount
    > > set dbc = server.createobject("ADODB.Connection")
    > > set rs = server.createobject("ADODB.Recordset")
    > > dbc.open "DSN=prono;UID=;PWD"
    > > SQL = "SELECT * FROM Artikel WHERE Text LIKE '%" &
    > > request.querystring("txtSearch") & "%' ORDER BY tid DESC"
    > > rs.open SQL, dbc
    > > rs.movelast
    > > %>
    > > ...
    > > <%=rs.recordcount%>
    > >
    > > A few lines down the page there is more code,
    > > but the error occurs on the "<%=rs.recordcount%>" line.
    > >
    > > Thanks!
    > >
    > >
    > >
    > > "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    > > news:3949743f$1@news.devx.com...
    > > > It sounds like you are opening the table as a forward only recordset,

    > and
    > > > then going backwards after using the .movelast. Are you using ADO or

    > DAO?
    > > > Can you post the code you are using, from when you open the table to

    > when
    > > > you get the error.
    > > >
    > > > John K. <john.k@home.se> wrote in message

    news:3949712e@news.devx.com...
    > > > > Ok, I tried your suggestion,
    > > > > but now get the error:
    > > > > Rowset does not support fetching backward.
    > > > >
    > > > > Why?
    > > > >
    > > > > Thanks!
    > > > >
    > > > > "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    > > > > news:394957a4$1@news.devx.com...
    > > > > > Before getting the .RecordCount, do .MoveLast.
    > > > > >
    > > > > >
    > > > > > John K. <john.k@home.se> wrote in message
    > > > news:39495565$1@news.devx.com...
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >




  9. #9
    BettyB Guest

    Re: RecordCount is -1 Why?

    Take a look at this tutorial <http://learnasp.com/learn/dbcount.asp>

    BB


    John K. wrote in message <394a1010@news.devx.com>...
    >I still get the error
    >
    >"T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote in message
    >news:39497c20@news.devx.com...
    >> You are opening the recordset as Forward Only,which is the default. Use

    >this
    >> to open the recordset:
    >>
    >> rs.open SQL, dbc, adOpenKeyset
    >>
    >>

    [...]



  10. #10
    Gena Guest

    Re: RecordCount is -1 Why?


    RecordCount for server side cursors returns "-1".
    Try to hange cursor type to client side:

    oRS.Source = SQL_str
    oRS.CursorLocation = 3 'adUseClient
    oRS.Open


    Gena

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center