Author |
Topic |
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 14 March 2002 : 17:34:13
|
quote:
What happens when you issue the SELECT COUNT(*) AS DVD_COUNT FROM FORUM_DVD from within Access rather than via an ASP page ?
www.daoc-halo.com
If I do that (hadn't done that ever before so I had to use the office help) I get 91 as a result, so that works correctly.
http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 14 March 2002 : 17:58:10
|
Just for the heck of it, try this"
<% strSql = "SELECT COUNT(*) FROM " & strTablePrefix & "DVD" set rstTest = myConn.execute(strSql) DVD_COUNT = rstTest(0) %>
Nikkol |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 14 March 2002 : 18:15:23
|
Ok, just to add the the growing confusion (I just can't believe you are tying up this many knowledgeable people on such a easy query, Roland )
Just do as you did before, create the SQL within Access, save it as a query and use the query name for strSql var in your ASP. I see no reason for this solution not to work.
------------------------------------------------- Installation Guide | Do's and Dont's | MODs |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 14 March 2002 : 18:31:42
|
Roland.... you are using my_conn NOT myConn !!!!! Hmph...
Nikkol |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 14 March 2002 : 18:55:53
|
LOL ... well spotted Nikkol
www.daoc-halo.com |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 14 March 2002 : 18:57:09
|
thx ... at least I'll be able to sleep tonight
Nikkol |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 14 March 2002 : 20:08:14
|
Anyone up for taking the next Class ? ASP - 201 using GetRows()
You could use GetRows to get the total number of records back using the one query. i.e (just an example based loosely on your code Roland) neither tested nor even syntax checked.
<% strsql = "SELECT DVDID, Title, Site, Actors FROM " & strTablePrefix & "DVD ORDER BY DVDID ASC" set rs = my_conn.execute(strsql)
if not rs.EOF then myDVD = rs.GetRows() ' Places recordset into an Array ' this is a basic two dimensional array, the first dimension is the data itself. ' The second dimension is the record number - rembering arrays are zero based the ' first record would be 0 the second 1 and so on ' So: ' myDVD(0,0) = DVDID of First Record ' myDVD(1,0) = Title of First Record ' myDVD(2,0) = Site of First Record ' myDVD(3,0) = Actors of First Record ' myDVD(0,1) = DVDID of Second Record ' etc ... etc ... etc ...
' Right now you could free up resource by doing the rs.close and set rs = nothing ' and set my_conn = nothing also as we have completely finished with the ' recordset.
rsCols = ubound(myDVD,1) ' ResultSet Columns rsRows = ubound(myDVD,2) ' ResultSet Rows
' Setup a variable to contain the record count myDVDTotal = rsRows + 1 ' add one becuase Arrays start at 0
for RowCount = 0 to rsRows %> <tr class="cellOff" onmouseover="className='cellOn'" onmouseout="className='cellOff'"> <td valign="top" width="200"><p class=default><%=myDVD(1,RowCount)%></td> <td valign="top"><p class=default><%=myDVD(3,RowCount) %></td> <td valign="top" width="30"><p class=default><% if Trim(myDVD(2,RowCount) <> "") then %><a href="<%=myDVD(2,RowCount)%>" target="_blank"><img src="images/buy.gif" border="0" title="Buy at Amazon.com" alt="Buy at Amazon.com"></a><% else Response.Write " " end if %></td> </tr> <% next
else
%> <tr> <td colspan=3 bgcolor="<%=strForumCellColor%>"><p class=default>No DVDs found</td> </tr> <%
end if rs.close set rs nothing
www.daoc-halo.com |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 14 March 2002 : 23:35:53
|
I use getrows() a lot. All of my FAQ site is programmed using VBS classes and data is all saved in GetRows() arrays, with Recordsets being closed as soon as the data is in the array.
Using arrays got a bit trickier when you want to change or update the data, but it's doable. My biggest gripe is if you go change your SQL statement you immediately break all your code, because adding or deleting a column changes the subscript values for the remaining columns (the ones to the right, anyway). If you're in the heavy prototype mode and make a lot of sql changes, using getrows() can generate some extra work, and strange bugs if you don't get all your array references updated properly.
Performance is pretty good, though.
====== Doug G ======
Edited by - Doug G on 14 March 2002 23:37:49 |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 14 March 2002 : 23:51:12
|
I haven't used getrows a lot yet myself, but for the things I've been playing with lately I've seen some nice performance increases.
Agree that its not really the most friendly way to do things especially when prototyping, was thinking that maybe it would be easier to take the array and put it all into variables for each row iteration before outputting it so you can change order of the SQL and make additions a 'little' easier, the variables can then be easily removed again once you've finished testing by just using some find and replace commands.
www.daoc-halo.com
Edited by - Gremlin on 14 March 2002 23:52:31 |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 15 March 2002 : 11:27:38
|
Yippie Roland! Looks good... here are some suggestions: You could group them by music or movie type and then give them sub-types like pop, rap, alternative, etc for music and sci-fi, horror, comedy, etc for movies.
Nikkol
Edited by - Nikkol on 15 March 2002 11:28:41 |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 15 March 2002 : 11:38:28
|
I'm planning on putting the movie type next to the title, either in text or icon format. Then clicking on the title will give a new page with more information.
Grouping movies is difficult as a lot of movies are both comedy and horror (teen horror is the correct term I believe lol). Perhaps in a later stage I'll group them, but right now going from a static page to this is quite some progress already
Thanks for the suggestion and all your help, Gremlin too.
http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 15 March 2002 : 17:15:41
|
Welcome Roland, check your email if you haven't already also, I think I've sent you all you need now for the logo submissions stuff sorry to take so long to get it done for ya.
www.daoc-halo.com |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 15 March 2002 : 17:22:33
|
Gremlin, I got the mail and it's online (going to test it over the weekend ). Thank you so much for that! As you know the name of the form page, you can go to it on http://www.frutzle.com/mywork/ and see it in action. The other pages don't have any info as I cleared those tables lol
I can now start making the page to add info to the DB for the DVD's pages too. The DVD's info pages already work by the way... I won't show the "new" DVD's pages for at least another week though as none of the pages have any info other than what's on the main page right now... lol Still, I wouldn't have been able to make the info page without your help.
http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
|
|
Topic |
|