If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > RecordCount/Rows Affected ADODB and Javascript

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-13-07, 10:53
Shaun.McGuile Shaun.McGuile is offline
Registered User
 
Join Date: Jun 2007
Location: Under a desk hiding from SSIS
Posts: 23
Angry 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
Reply With Quote
  #2 (permalink)  
Old 08-13-07, 11:03
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
This might be well worth a read
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 08-13-07, 11:05
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Also, what cursor type are you using here? If I remember rightly, you can only use RecordCount using certain cursors.
__________________
George
Twitter | Blog
Reply With Quote
  #4 (permalink)  
Old 08-13-07, 11:12
Shaun.McGuile Shaun.McGuile is offline
Registered User
 
Join Date: Jun 2007
Location: Under a desk hiding from SSIS
Posts: 23
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?
Reply With Quote
  #5 (permalink)  
Old 08-13-07, 11:17
Shaun.McGuile Shaun.McGuile is offline
Registered User
 
Join Date: Jun 2007
Location: Under a desk hiding from SSIS
Posts: 23
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.
Reply With Quote
  #6 (permalink)  
Old 08-13-07, 11:22
Shaun.McGuile Shaun.McGuile is offline
Registered User
 
Join Date: Jun 2007
Location: Under a desk hiding from SSIS
Posts: 23
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".
Reply With Quote
  #7 (permalink)  
Old 08-13-07, 11:24
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
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
Twitter | Blog
Reply With Quote
  #8 (permalink)  
Old 08-13-07, 11:24
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
"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
Twitter | Blog
Reply With Quote
  #9 (permalink)  
Old 08-13-07, 11:30
Shaun.McGuile Shaun.McGuile is offline
Registered User
 
Join Date: Jun 2007
Location: Under a desk hiding from SSIS
Posts: 23
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.
Reply With Quote
  #10 (permalink)  
Old 08-13-07, 13:47
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I've been posting a lot on here..?
And yeah, the Yaks are a bad influence on little old me
__________________
George
Twitter | Blog
Reply With Quote
  #11 (permalink)  
Old 08-15-07, 12:01
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Quote:
Originally Posted by georgev
And yeah, the Yaks are a bad influence on little old me
I resent that
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #12 (permalink)  
Old 08-15-07, 12:25
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I'm sorry Poots, I take it back
__________________
George
Twitter | Blog
Reply With Quote
  #13 (permalink)  
Old 08-16-07, 04:48
Shaun.McGuile Shaun.McGuile is offline
Registered User
 
Join Date: Jun 2007
Location: Under a desk hiding from SSIS
Posts: 23
When's it gonna change to <3 Married?
Reply With Quote
  #14 (permalink)  
Old 08-16-07, 04:49
Shaun.McGuile Shaun.McGuile is offline
Registered User
 
Join Date: Jun 2007
Location: Under a desk hiding from SSIS
Posts: 23
Yeah you don't wanna get wacked by the cuddliest hit flump in the business!
Reply With Quote
  #15 (permalink)  
Old 08-16-07, 04:53
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
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
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On