a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

2 Questions

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> 2 Questions
Page: [1]
 
Giomanach

 

Posts: 6136
Joined: 11/19/2003
From: England
Status: offline

 
2 Questions - 3/8/2005 15:04:48   
Question 1:

<%
strSQL = "Select * FROM users"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open strSQL, MyDSN
NoRecords = RS.RecordCount
%>


Returns -1, it's counting the wrong way...how do I get it to count up.

Question 2:

Random records - how to do?

Currently re-working an abandoned project (you know, those clients who bugger orf without saying anything), and I want to add a random quote bit to it. All DB reliant.

TIA

Dan

_____________________________



dzirkelb1

 

Posts: 1321
Joined: 10/5/2004
From: Cedar Rapids, Iowa
Status: offline

 
RE: 2 Questions - 3/8/2005 15:08:53   
A quick guess on the random one...depending on how many quotes you have, you could pull the current time and have the seconds be the randomizer....then, have simple sql query to be select quote from table where quoteid="&second&" or something basic like that...unsure if that is what you are looking for though, but could pose as a quick fix it :)

(in reply to Giomanach)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: 2 Questions - 3/8/2005 15:31:13   
quote:

Returns -1


Try it this way:

<%
strSQL = "Select * FROM users"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open strSQL, MyDSN
RS.MoveLast
NoRecords = RS.RecordCount
%>

As to random record, this might help:

http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=65

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to dzirkelb1)
Giomanach

 

Posts: 6136
Joined: 11/19/2003
From: England
Status: offline

 
RE: 2 Questions - 3/8/2005 17:59:22   
quote:

RS.MoveLast

Returns:

Microsoft JET Database Engine (0x80040E24)
Rowset does not support fetching backward.
/portal/ASP/includes/common.inc, line 41


I'll get back to you on the randomness

_____________________________




(in reply to rdouglass)
Spooky

 

Posts: 26617
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: 2 Questions - 3/8/2005 18:57:17   
Random :
Use "... ORDER BY NewID()"

Record count :
http://www.aspfaq.com/show.asp?id=2193

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to Giomanach)
Giomanach

 

Posts: 6136
Joined: 11/19/2003
From: England
Status: offline

 
RE: 2 Questions - 3/8/2005 19:15:50   
:)

_____________________________




(in reply to Spooky)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> 2 Questions
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts