Controlling Random Records

i am currently working on an online test tool using ASP. Now, the questions would be generated randomly from a database(access), so two or more candidates will not have the same question. There will be one question per page. Now, i have successfully generated the radom questions from the database.

But i have a problem which is:

1. When i click the next link to go the next question, my code displays the question on the previous.

2. Also, when i click on the previous link to go back to the previous question my code changes the question from the previously answered to a new question. Code:

View Replies


ADVERTISEMENT

3 Random Records From DB

I want to take 3 records from a database. The selection must first take any record marked as priority and then random records (so there could be 3 priority records and no more or 1 priority and 2 random etc)
My theory is to build a recordset filtered by records marked priority, and if there are less than 3, build a second recordset of all the other records.
Questions
1, how can I select random records form the second recordset, without selecting the same one twice?
2, OR, could I write a sql statement which would randomly select 3 records from my table
3, Or is they a way I could write a query (view) in Access which would do the whole lot for me (select the priority records and then random records up to 3)?

View Replies View Related

Random Records

I know how to generate random record from a database, the problem i need to overcome is like this:

1.If the user refreshes the page is a way i can control the randomized data from not repeating itself on display?

View Replies View Related

DB Random Records From Array

I have read 10000 opinions on returning random records and I am more
confused now that before I started. I have a small access db that will
contain 20 or so rows with 3 or 4 columns. I like to return a set of 6
distinct rows and display the columns in html. I have seen response.write
and loops but can't I throw the 6 random rows in a array and pull the data
as I need it in the page? Examples?

View Replies View Related

Random Pictures Records

I have this page where I want to display 3 random pictures in a vertical table. Each picture represents a record in an Access database. The field "picname" holds the name of the picture (e.g. "pic1.jpg", "pic2.jpg", etc). Each record has a unique ID. How do I go about selecting these 3 records? I want the pictures to alternate everytime someone enters the page or refreshes it. I found a couple of javascript options, but they only choose the picture from within a folder, and I need to be able to link the pictures to each record.I don't know if I made myself clear enough.

View Replies View Related

Random Display Of Records

I am doing a simple program which display random records to students.The student table has the following fields(Access Database) Code:

1.Studentid-Number
2.Studentname-Text
3.Class-Text
4.Ans-Text

and Question table as

1.Questionid-Number
2.Questions-Text

Now What i am trying to do is , when the first time is student is login,he wil be shown a random record from the question and his answered wil be stored in the Ans field of the student table with column separeated.

The he will be redirected to the same page with one new question.This question should not be in the Ans Field, and must be randomly generated.I am using this code.But this not working. Code:

View Replies View Related

Random Records Code

Here's what i need:

[vbs]
"SELECT * FROM Articles WHERE Category = 'Reviews' and SubCat = {RANDOM CATEGORY} LIMIT 5;"
[/vbs]

Now, I think the last post on the thread I read said the guy could make an Array and just pick a random item out of that...and that makes sense in my case, listing all the Categories and then picking a random one.But, I don't know how to do it! I don't have much experience in arrays

View Replies View Related

Displaying 2 Random Records For DB

Im looking for a very simple and small script that will display 2 random records for a database, but i havnt found one yet. Can someone help me on this one?

View Replies View Related

Random Database Records

I'm trying to create a portion of script that would select x (variable) number of random records from a table.

in PHP, I could do this pretty simply with a line like, "select * from table order by rand() limit x", but the solutions I've seen so far for asp and access involve things like 40 lines of code, selecting the entire contents of a database, creating temporary tables, etc.

Is there any quick and dirty way of doing this?

View Replies View Related

Selecting Random Records

i want to select some records from my database by random. i want also to set a limit (limit=9).

View Replies View Related

Select 5 Random Records

I want to select 5 random records from my database..I tried to suft the net and foundout this sql

SELECT TOP (3) Question, Choice1, Choice2, Choice3, Choice4
FROM Question

But when i tried to execute,i t always gave me the most top 2 records. why?Is this sql statement woring?How can i select 5 random records from the database?

View Replies View Related

Weighted Random Records

Do you have any idea about weighted random records ? (for MSAccess AND SQL Server) Also can I get weighted random records just by SQL Language ?

View Replies View Related

Selecting Random Records From 2 Different Databases

I have a tough question that i ca't get over it for all the day.
I have two different news tables. I can't get any of them and list.

Bu i want to do something different. I want to get both and randomize them and list them.

for example,

1. news (from the 1st db)
2. news (from the 2nd db)

etc.

is that possible, because i couln't find any solution for this.

View Replies View Related

9 Random Records - Returns All But First Record In RS

I have been using this script which basically works fine, with on hitch. I populate a recordset from a database. Then, use the total number of records as a UBound.

I then want to display 9 random records. I get my 9 random images, but for some reason, if I do a sort by ID on the database, the lowest numbered ID file never comes up in the list. Here is my code: Code:

View Replies View Related

To Retreive 'unique' Random Records

I have to develop an online quiz on my website. the site is developed in ASP.
i have a access database of the questions, the multiple ans.s and the correct ans. every quest. has an unique id.

i want a way by which any 10 'unique' quests. will be selected from the database everytime an user takes the test.

View Replies View Related

Selecting Random Records From Database How?

The following code should select the specified number of records randomly from the database .....

View Replies View Related

Show Random Records - New Set On Refresh!

I know there are plenty of threads relating to 'random' records, but non of the code samples seem to return random results each time I refresh the page; or don't show any results at all? The ID numbers for my recordset are not necessarily consecutive numbers (some items may have been deleted). I simply want to feature 2 or 3 random news teasers on my home page WHERE feature="yes". I guess I need to call 3 random id's, and keep looking until a record is returned? I would also like to change the number of 'teasers' displayed via another database table - I can do this later, but the code has to accommodate a flexible way to change how many records are returned.

Here's the Access table:

news (TBL):
id
title
shortdescr
longdescr
feature

If you have a possible answer for me could you please provide sample code and spell it out clearly.

View Replies View Related

Display Records In Random Order

I Have searched the forum but have no solution to this problem.

I want to display my records in a random order. I loop through my records so I don't know how many records will be displayed. I dont want to count the records and then use the TOP statement. I'm looking for a better solution.

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SELECT test FROM testTable WHERE testId = 1, objConn
Do While Not rs.EOF
Response.Write "<b>" & rs("test") & "</b>" <- I want theese records to be displayed in random order
rs.MoveNext
Loop

Anyone has a solution to this problem?

View Replies View Related

Returning Random 10 Records Form A Database?

How can I do it?

View Replies View Related

Pick Five Records At Random From Db And Rotate Them Weekly

I need to pull five records randomly from a database, and display them on a web page. These need to change weekly.

Is there a way to do this in ASP?

View Replies View Related

Controlling Services

since we run BIND as our DNS, I'd like to be able to force it reload changed zone files via an ASP page. I don't need to restart the service itself. There is a specific command that can be sent to it that'll reload the zones without restarting the service, but I don't know how to execute it.

i'd like to be able to create and manage IIS websites from an ASP page. Is there any documentation on this? It must be possible, but I can't find out how.

View Replies View Related

Controlling Content With Variables

I am looking for the code to enable me to change the content of my asp site through the ajustment of variables.

I have index.asp (content included into this)

Would like to be able to have 'index.asp?page=Contact'

And it would 'include' the contact.asp information into index.asp

I found some code in another thread but didnt want to hijack it. This is down the right lines but it wouldnt work for me

Quote: Server object error 'ASP 0230 : 80004005'

Server.Transfer Error

/SITETEST/test2/index.asp, line 28

The call to Server.Transfer failed while loading the page. and it doesnt control content through includes. Code:

View Replies View Related

Controlling Printer Setup

I have an ASP page where I need to give users a button to print the screen in ladscape. How do i do it in vbscript or in javascript. Can't convert the data to pdf and send it to them.If i have to use printer object can someone show me how to create/instantiate a printer object before i can print it.

View Replies View Related

Controlling Frame Busting

how to control frame busting. My application has a frame where i open the site user has select to view. Frame busting is, preventing that your page is caught in someone else's frameset.

So when user select yahoo.com or else which has frame busting technology impemented it will occupy my aaplication's window by setting "top.location=self.location" But i wanna know if the current page is going to occupy my window then open that site using window.open(URL) instead opening it in userFrame. Awaiting for the fastest responnse.

View Replies View Related

[XPOST] Controlling The Commandline Via ASP/WSH

I have a problem letting this small script I wrote work correctly. In
particular i can't manage to execute commands that require user
input/confirmation. How should i handle that? Code:

View Replies View Related

Session Timeout - Controlling

I am using global.asa to set time out after a user logs.
It looks like this:

Sub Session_OnStart
Session.Timeout = 900
End Sub

I want to detect when the session has timed out and redirect the use to the login page.

View Replies View Related

Controlling Concurrency To Access Web Pages

We have an issue where we need to control access to specific web pages e.g. if one user is editing a purchase requisition another user shouldn't be able to perform any actions on it.

I presume we could lock the purchase requisition for editing by a specific user when an edit button is pressed. Only that user would then be able to edit the document. However can anyone think of any better approaches to this issue which I presume must be quite common in other application domains.

View Replies View Related

Controlling Mouse Pointer Appearance

I have a simple collapsible table that displays when a Label is clicked. However, since the label is only plaintext, the mouse becomes an insertion icon (I-bar) when over the text. Because of this, a user might not understand that the label is clickable. Is there a way to control the mouse appearance so that it shows the standard pointing finger, WITHOUT creating an anchor? Due to other elements in the page, it cannot link back to itself without erroring out.

View Replies View Related

How Do I Make Random Images Not Random?

However, what I want to do is include a request.querystring("ID"), so that IF an ID is defined, eg ID=3, , it will display the relevant (not random) information. I've tried this every way I can think and get type mismatches, etc etc. It's probably really simple but I can't see it.

<%
limit=3
redim link(limit)
redim image (limit)

link(1)="xxx"
image(1)="image1.jpg"

link(2)="xxx"
image(2)="image2.jpg"

link(3)="xxx"
image(3)="image3.jpg"

randomize
random=int(rnd*limit)+1

%>
<center>
<a href="<%= link(random) %>">
<img src="<%= image(random) %>" border="0"></a>

View Replies View Related

Making It Random (getting Random Numbers)

I just wanted to know whats the best way to generate 50 or say X amount of number at random without having to repeat any of the previous number...

so far I've the following:

[VBS]<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
function RandomNumber()
dim theRandom

Randomize
'RandomNumber = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

theRandom= Int((99 - (0) + 1) * Rnd + (0))

if (theRandom<10) then theRandom = "0" & theRandom

RandomNumber = theRandom
end function
%>[/VBS]

and then I've this in the body of HTML doc: Code:

View Replies View Related

Random Token Generator - Not Really Random

We have the need to have a random token (a 16 char alphanumeric field) to be used as the key for one of our SQL tables. I have created a random token generator, however after only 3 months in production, it appears that we had an instance where a token that already existed in the tables was created. There are 3810 records currently in the database so it isn't like there are billions of records there.

I contacted an old college buddy of mine who is a mathematician, and he claims, assuming that random really does mean random, that the chances of getting a duplicate token are 1 in 79.5 septillion (79,500,000,000,000,000,000,000,000).

So my conclusion is that this was either a complete freak of nature occurance, or my random generator isn't really all that random. Here is the code behind how I am generating this: Code:

View Replies View Related

Random Number Not Random

I am trying to generate a random number. I am using randomize and then rnd to return a decimal number between 100 and 120. This will give me a longitude. I am doing something similar to generate a latitude.

I created this on a page which refreshs every minute. I put these points into a map and they are showing up in groups of straight lines. Since rnd is time based will refreshing every 60 seconds return similar numbers?

View Replies View Related

Systematic Updating Of Records Depending On Amount Of Records In Another Table

The problem concerns 2 tables, cart_products and cart_shoppingcart.

Cart_products contains all the product data (eg, prices, product's key name, etc), but most importantly, it contains the quantity of stock (prod_quantity) for each item.

cart_shoppingcart contains all of the user's items in their shoppingcart, including those that are part of an (customer) order; these have the order_number to differentiate from those that aren't in any order (their Order_number is 'no_order', the others have the order number).

Now, what I want to do is this:

For every item in the order (ie, every entry in cart_shoppingcart that matches the username and order number), take the quantity (x) the customer is ordering, then take the quantity of stock remaining (y), then subtract x from y to create the new stock level (z) and update the appropriate record in cart_products with z (all this with SQl preferably).

I was thinking of using a Do while loop, but realised that it wouldn't work as I'd have to use several SQL statements and then I'd run into a problem the minute ASP reads "objrec.movenext".

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved