Results 1 to 15 of 15
  1. #1
    Join Date
    Jun 2007
    Location
    Under a desk hiding from SSIS
    Posts
    25

    Angry Unanswered: RecordCount/Rows Affected ADODB and Javascript

    Hey here's a good one -

    I'm trying without success to get the recordcount property of an adodb recordset object populated by using the adodb.connection execute method in javascript.

    The <insert rude words here> always reports either -1 or 0 depending on how I try to get at it. However I know I have six records returned into the recordset object as I can traverse the set using the moveNext() method.

    Here is my code
    Code:
    //DataConn is a legit data source that works (SQLServer) as I can see the data.
    SQL = "Exec sp_GetAccountRate @IdString = \"918|808|1214|89|995|300|\""
    	
    AccountsData.Data = DataConn.Execute(SQL,rows,1);
    Response.Write("No Of Records = " + AccountsData.Data.recordCount);// = 'No Of Records = -1'
    Response.Write("No Of Records = " + rows ); //No Of Records = 0

    Why does this not work?

    When I run the stored proc in SQL analyzer I get the expected data and a rows affected count of 6, @@ROWCOUNT also reports 6.



    regards

    Shaun McGuile

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    This might be well worth a read
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Also, what cursor type are you using here? If I remember rightly, you can only use RecordCount using certain cursors.
    George
    Home | Blog

  4. #4
    Join Date
    Jun 2007
    Location
    Under a desk hiding from SSIS
    Posts
    25

    Cursor type?

    Yeah, issue is how do I open a recordset in javascript?

    I can use command or connection execute() ok, but that just gives me a forward only cursor.

    I take it then, record count won't work using this method?

    Also the <more rude words> won't allow me to do a while loop checking for not EOF.

    So I can't even count up as I do moveNext().

    Damn why can't it just work like VBScript?

    Cheers GeorgeV.

    Is your girlfriend nay fiancee better these days, last I read she was ill in where was it south america?

  5. #5
    Join Date
    Jun 2007
    Location
    Under a desk hiding from SSIS
    Posts
    25
    By GeorgeV you've cracked it for me I had not realised I could do next record set method on the object. My stored proc has the Select @@ROWCOUNT as [Rows] in it.

    Just gotta test it works.

    Cheers.

  6. #6
    Join Date
    Jun 2007
    Location
    Under a desk hiding from SSIS
    Posts
    25
    Well <hugely relieved rude words> it works.

    I can now use a for loop.

    Dynamic web pages without VBScript here we go.

    ;-)

    Regards

    Shaun McGuile

    'Every answer possible is there on the web, you just have to ask the precise question to get the precise answer".

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by Shaun.McGuile
    Is your girlfriend nay fiancee better these days, last I read she was ill in where was it south america?
    Very observant of you! She's doing much better now thank you All the tests for nasties have finally come back and they're all negative *jumps for joy*.

    She was back for a couple of weeks before she swanned off to Italy to climb mountains... She's back tomorrow though

    Thanks for asking - and I hope you can get this to work!
    George
    Home | Blog

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    "Every answer possible is there on the web, you just have to ask the precise question to get the precise answer"

    True for SQL too
    George
    Home | Blog

  9. #9
    Join Date
    Jun 2007
    Location
    Under a desk hiding from SSIS
    Posts
    25
    Crikey I've just seen your post count!

    What have you been doing? Hanging around the Yak Corral crowd too much?
    Or not enough? lol.

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I've been posting a lot on here..?
    And yeah, the Yaks are a bad influence on little old me
    George
    Home | Blog

  11. #11
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by georgev
    And yeah, the Yaks are a bad influence on little old me
    I resent that
    Testimonial:
    pootle flump
    ur codings are working excelent.

  12. #12
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I'm sorry Poots, I take it back
    George
    Home | Blog

  13. #13
    Join Date
    Jun 2007
    Location
    Under a desk hiding from SSIS
    Posts
    25
    When's it gonna change to <3 Married?

  14. #14
    Join Date
    Jun 2007
    Location
    Under a desk hiding from SSIS
    Posts
    25
    Yeah you don't wanna get wacked by the cuddliest hit flump in the business!

  15. #15
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    We've decided to wait until she graduates university - so another 3 years yet
    Sadly she's off to Uni and I'm staying at my job, so we'll be living about 1-1.5hours apart
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •