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

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Counting .... uhh.. someone help please
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 4

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 14 March 2002 :  17:34:13  Show Profile
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 14 March 2002 :  17:35:26  Show Profile
quote:

Was the part in green just a typo?

Nikkol



No, I'm lazy and copied that code from an earlier post instead of my file...



http://www.frutzle.com

Snitz Exchange | Do's and Dont's
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 March 2002 :  17:58:10  Show Profile
Just for the heck of it, try this"

<% strSql = "SELECT COUNT(*) FROM " & strTablePrefix & "DVD"
set rstTest = myConn.execute(strSql)
DVD_COUNT = rstTest(0)
%>



Nikkol
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 14 March 2002 :  18:15:23  Show Profile  Send ruirib a Yahoo! Message
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
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 March 2002 :  18:31:42  Show Profile
Roland.... you are using my_conn NOT myConn !!!!! Hmph...

Nikkol
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 14 March 2002 :  18:55:53  Show Profile  Visit Gremlin's Homepage
LOL ... well spotted Nikkol

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

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 March 2002 :  18:57:09  Show Profile
thx ... at least I'll be able to sleep tonight

Nikkol
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 14 March 2002 :  20:08:14  Show Profile  Visit Gremlin's Homepage
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
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 14 March 2002 :  23:35:53  Show Profile
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
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 14 March 2002 :  23:51:12  Show Profile  Visit Gremlin's Homepage
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 15 March 2002 :  11:17:14  Show Profile
Wow... okay, so I miss-spelled my_conn

Anyway, the demo is online at http://www.frutzle.com/dvds/newdefault.asp but there might still be a bug or two in it.
I'll re-write some of the code soon and create info pages (the default page will lose some of it's content).

Thanks for all your help!



http://www.frutzle.com

Snitz Exchange | Do's and Dont's
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 15 March 2002 :  11:27:38  Show Profile
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 15 March 2002 :  11:38:28  Show Profile
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
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 15 March 2002 :  17:15:41  Show Profile  Visit Gremlin's Homepage
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 15 March 2002 :  17:22:33  Show Profile
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
Go to Top of Page
Page: of 4 Previous Topic Topic Next Topic  
Previous Page | Next Page
 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.31 seconds. Powered By: Snitz Forums 2000 Version 3.4.07