Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Almost Snitz Related......
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Xstream-PT
Starting Member

45 Posts

Posted - 07 May 2002 :  17:00:43  Show Profile
I'm working hard on threading my version of Snitz, but I ran into a doozie... Does getrows work with Views? For somereason, I'm unable to pull any records with getrows on a view I have. It works when I use the recordset object... Any ideas?

Xstream

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 07 May 2002 :  19:19:33  Show Profile  Visit Gremlin's Homepage
Yes it should work fine.

By the time you get to issue the GetRows() command, your data is already in a recordset, GetRows() doesn't care how that data got into the recordset, be it from a view, a stored procedure or from just an SQL Query.

Double check your Query and make sure it actually is returned a recordset, if that fails post your code maybe we can spot something there thats not right.


www.daoc-halo.com
Go to Top of Page

Xstream-PT
Starting Member

45 Posts

Posted - 08 May 2002 :  21:44:31  Show Profile
striSQL ="SELECT id, filename, downloadCount, hits, eereq FROM vTop25Files30Day ORDER BY downloadcount DESC"


objeRS.Open striSQL, objConn

If not objeRS.EOF then
Response.Write "Im getting something"
hotfiles = objeRS.GetRows(10,0)
objeRS.Close
for i = 0 to 9
id = hotfiles(0,i)
filename = hotfiles(1,i)
downloadcount = topfiles(2,i)
hits = hotfiles(3,i)
eereq = hotfiles(4,i)

image = eereq
Call imagelist
Call Topfiles
Next
End If
%>


<%
Sub topfiles()
NUMBLIST = i + 1
%> <tr>
<td width="50%" bgcolor="#B7AB91"><font color="black" width="100%" size="2" face="Tahoma">
<img border="0" src="<%=image %>" width="16" height="16">
#<%=NUMBLIST %>) <a href="dl_file.asp?id=<%=id %>"><%=filename%></a>
</font><font color="black" width="100%" face="Tahoma" size="1">[<%=downloadcount %> Downloads]</font></td>
<%

end sub
%>

Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 08 May 2002 :  22:06:34  Show Profile  Visit Gremlin's Homepage
try changing this line from

hotfiles = objeRS.GetRows(10,0)

to

hotfiles = objeRS.GetRows()

I didn't think GetRows actually accepted any parameter input.

Heres the code I always use for my getrows recordsets (after you've retrieved the recordset via whichever method you prefer)

if not rs.EOF then
MyArray = rs.GetRows()
rs.close()
set rs = nothing
MyArrayCols = ubound(MyArray,1) ' Number of columns in Array
MyArrayRows = ubound(MyArray,2) ' Number of Rows in Array
else
MyArrayCols = 0 ' no records so set to zero
MyArrayRows = 0 ' no records so set to zero
end if

This sets up two variables for you to easily index through the Array etc.





www.daoc-halo.com
Go to Top of Page

Xstream-PT
Starting Member

45 Posts

Posted - 08 May 2002 :  22:11:45  Show Profile
That's weird because I've used that same basic code for other lists where I only wanted ten records. How would I use your code to only display ten records?


X

Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 09 May 2002 :  01:29:13  Show Profile  Visit Gremlin's Homepage
Well I've learnt something today myself, I'd never seen anything documented about GetRows that showed it had parameters available

GetRows(rows,start,fields)

So dissregard what I said above, I was quite obviously talking through a hole in my head.

If your only wanting to get 10 records though, why not limit the SQL rather than limiting it via GetRows() ? Adding TOP 10 to your clause 'might' be a little more efficient.

I don't see any reason now though, providing your query is returning data for this not to be working sorry :(



www.daoc-halo.com
Go to Top of Page

Xstream-PT
Starting Member

45 Posts

Posted - 09 May 2002 :  09:49:49  Show Profile
Well, now I'm really stuck. Do you know of any good articles online on how to use getrows()? The only way I know how to use them is with the way I described, I have no idea your way..

X

Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 09 May 2002 :  13:10:30  Show Profile  Visit Gremlin's Homepage
the only difference between your way an my way is that your telling GetRows to only move the first 10 record in the recordset into the array. Mine tells it to move ALL records in the recordset.

ubound(array,1) this command in my example finds the highest boundary for the columns in the getrow array (remember getrows creates a two dimension array with the first dimension being the columns in the recordset and the second the rows)

4guysfromrolla have some article on getrows I'm sure, in fact probably all the big ASP sites have a few articles. Try searching on goodgle for ASP+GetRows



www.daoc-halo.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.34 seconds. Powered By: Snitz Forums 2000 Version 3.4.07