Home > ASP Development > Out of memory: 'rsItems.RecordCount'

Out of memory: 'rsItems.RecordCount'



Im reciving this error:

Out of memory: 'rsItems.RecordCount'

On line:

temp=Int(RND * rsitems.RecordCount)




Code:



<!--#INCLUDE VIRTUAL="connect.inc"-->
<%
'--------------Get Account ID Num--------------
Dim conn,rst
Dim Un(),NumRec,i

strsql ="SELECT * FROM tb_accounts"
rsItems.Open strSQL, adoCon
NumRec=4
ReDim Un(NumRec-1)
Randomize
for i=0 to NumRec-1
Un(i)=GetUnNumber
next
for i=0 to NumRec-1
rsitems.MoveFirst
rsitems.Move Un(i)
next

Function GetUnNumber
Dim temp,j
temp=Int(RND * rsitems.RecordCount)
for j=0 to NumRec-1
if temp=Un(j) then GetUnNumber
next
GetUnNumber=temp
End Function
response.write GetUnNumber
%>






Hope you can help,

Thanks,

Billy

    
Guest


the problem is that rsitems.RecordCount is -1 so temp is never

equal to Un(j) - have such code to have the record count available:


Code:



rsItems.CursorLocation = 3 'adUseClient
rsItems.Open strSQL, adoCon



Was this answer helpful ? Yes No   
Guest


Great ty

Quote:
Originally Posted by Shadow Wizard
the problem is that rsitems.RecordCount is -1 so temp is never

equal to Un(j) - have such code to have the record count available:


Code:



rsItems.CursorLocation = 3 'adUseClient
rsItems.Open strSQL, adoCon



Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved