Selecting random rows from a database


I've got an application I'm working on that will be used to generate and track the results of a computer based test. What my boss want's to do is have a repository of questions. Have some questions coded so they are always asked, and the remainder of the test come from randomly selected questions.

I'm having trouble figuring out how to pull random rows from a table and make sure that that they haven't already been selected.

I'd appreciate any advice on how to handle this.

Posted On: Friday 26th of October 2012 07:35:59 AM Total Views:  447
View Complete with Replies

RELATED TOPICS OF ASP PROGRAMMING LANGUAGE




Having trouble selecting the latest 25 entries

I'm having trouble selecting the last 25 entries into a recordset. My script looks like this.... Code: elseif startletter = "all" then sql = "SELECT TOP 25 * FROM "&console&"previews ORDER BY previewdate DESC" The rest of the code is as follows but it only gives me an error when startletter=all Code: Microsoft OLE DB Provider for ODBC Drivers error '80040e21' ODBC driver does not support the requested properties. /reviews.asp, line 26 line 26 is the connection line btw
VIEWS ON THIS POST

168

Posted on:

Wednesday 10th October 2012
View Replies!

selecting values that do not match

hi there i need to display results that do not match those in the database. I have an excel file and i upload it, inserting the records in a temp table. Than i compare the values in the original table and the temp table. i want is the values that do not match.. i did this: Code: sql = "SELECT TempSerial.SerialNo "&_ "FROM TempSerial, Serial WHERE TempSerial.SerialNo Serial.SerialNo "&_ "OrderBY TempSerial.SerialNo;" Set RS = objConn.Execute(sql) i displayed the records with but i get all the records in the temp table displyed. Could anyone please enlighten me
VIEWS ON THIS POST

154

Posted on:

Wednesday 10th October 2012
View Replies!

selecting checkboxes from another page

I got links in one page to a contact us form in another page, in teh conatct us page there are a number of checkboxes realting to events in other pages. is it possible when the user clicks a contact us link in one page that the checkbox in the contact us page is selected automatically
VIEWS ON THIS POST

165

Posted on:

Thursday 11th October 2012
View Replies!

help with selecting a date range

hey folks, i am fairly new to asp programing and databases. This is what i want to do: I run an intranet and I have an Access Database that i want a user to be able to select from an asp web page a date range (say Jan1-Jan15), then it would go and retrieve from a query in my database fields in the query that fall within that date selected. i dont know how to do this. Anyone know where i can find a sample of code that would do this, or can it be done from withing FP2003 easily\t
VIEWS ON THIS POST

158

Posted on:

Thursday 11th October 2012
View Replies!

Change menu on selecting pull down menu

hi! I want to have two pull down menus, 1 for continents and the other for countries. On selecting the continent how can I change the menu of another pulldown or how to display the list of corresponding countries in that. And if no continent is selected then nothing should appear in countries pulldown. Any help would be appreciated. It will be great if somebody would help me with the codes, or some Url from where I can get the code. Many
VIEWS ON THIS POST

153

Posted on:

Thursday 11th October 2012
View Replies!

selecting last row in database

Originally posted by : chrissy (c.edlund@mail.utexas.edu)what is the easiest way to get a page to display only the last row of information from a database
VIEWS ON THIS POST

159

Posted on:

Thursday 11th October 2012
View Replies!

selecting, downloading, printing and viewing multiple PDF files

Originally posted by : Antonio (vola@sogi.com)I have a list of PDF files on an ASP page and I would like to permit the user to select one or multiple files and give him the choice to dowload, print or view these files.How can I do this
VIEWS ON THIS POST

175

Posted on:

Thursday 11th October 2012
View Replies!

storing dates as int but selecting them as date

while I store the dates as is in db, I can use a select statement like this mySQL="SELECT SUM(total) AS totalSum, month(orderdate) AS monthsql FROM orderDetails GROUP BY MONTH(orderdate)" but when I use dates as integer, it simply gives me error. Are there any way of getting over that problem Any solution , Originally Posted by fillup07 What is the format that the date is in in the text field (give me an example date and actual SQL). it's in yyyymmddhhmmss format.
VIEWS ON THIS POST

179

Posted on:

Friday 12th October 2012
View Replies!

SQL - selecting multiple values

Originally posted by : Raghavendra (raghu@raghavendrareddy.com)How to select multiple values in the same column using SQL I tried with the following code but didnt work. Do you have any idea!sql = "SELECT * FROM ppel WHERE country LIKE 'India'" for q = 1 to count sql = sql & "AND rfr LIKE '"&trim(z(q))&"'"end ifnextRaghu
VIEWS ON THIS POST

167

Posted on:

Friday 12th October 2012
View Replies!

session variable selecting certain data.

I have made a text box/form page which directs the user to a results page. I want this page to filter the data depending on the username they enter. My SQL on the results page looks like this.CODErs_sort.Source = "SELECT *\tFROM tblmakemodel\tWHERE username = &"(sessFirstName)"& " It doesn't work and I know it's not correct but what is the right code sessFirstName is the session variable which I can pass to this results page but can't seem to filter the data.Dreamweaver has produced all the code! My next problem is passing the username from a logon page to the results page AND filter the data. If I can't get this bit, which is simple, I feel like jacking it all in.TIA.
VIEWS ON THIS POST

150

Posted on:

Monday 15th October 2012
View Replies!

Add record to db, then when selecting records new one wont appea

After I successfully add a record to a database (ACCESS or SQL) I then, on the same page, to a SELECT all records but the one I have just added doesn't show up.\tIf I then go the the same page, via a link, the new on is there.\tIs there any way to stop this, by resetting the db connection or something\t
VIEWS ON THIS POST

167

Posted on:

Tuesday 16th October 2012
View Replies!

Problem selecting name and displaying in email

I need serious and urgent help, please.I have an email program that selects names inserted to the database and sends an email to them based on their names.For instance, &staff&, &deputy& and &supervisor& are inserted into tblEmployAccident table.Those names are then selected by an email program and then an email is sent to their departments.The problem I am having with this is that these names are selected dynamically from one table and inserted into this table. (please see below).So for instance, to select &staff& from one table and inserted into another table would be something like selected the id from one table an inserting that id into another table.That way, to get the name, you would select the staffname from one table where id from that table matches Id from the table where it was inserted.How do I get the real name to be displayed on the email rather that the Id.example, if I say for instance, that an event occured involving &staff& on &eventDate&,eventdate will show the date of the event but the &staff& will display the id, not the name.What can I do to display the name instead of the idI am sorry if this is a bit foggy. I can explain further.emailDB.Execute "INSERT INTO tblEmployEvent (empID, TrackingNumber,Completed,NumEmail) VALUES ("&staff&", "&TrackingNumber&",0,0)"emailDB.Execute "INSERT INTO tblEmployEvent (empID, TrackingNumber,Completed,NumEmail) VALUES ("&Deputy&", "&TrackingNumber&",0,0)"emailDB.Execute "INSERT INTO tblEmployEvent (empID, TrackingNumber,Completed,NumEmail) VALUES ("&Supervisor&", "&TrackingNumber&",0,0)"
VIEWS ON THIS POST

225

Posted on:

Tuesday 16th October 2012
View Replies!

Printing a sub by selecting a category from a drop down list

Like the title says, I need to be able to print the output from a sub function by selecting a category from a drop down list. I don't know if I am going about it the right way so I don't even know if a sub is the righ thing to use. Here's the code, when I select Cars I want the getCars() sub to print the list of cars, same thing for Clothes, Food, and Furniture. I've tried the onchange method but it won't work. Code: Array_Stuff Choose... Cars Clothes Food Furniture
VIEWS ON THIS POST

183

Posted on:

Friday 26th October 2012
View Replies!

Options selecting

Hi I am trying to create a page where the user can select options in drop down lists then when they click a link on a menu the options are read and acted on. Example: Drop down list containing County's, User selects a county, then clicks a link in the menu to show all records. I want the page to then show all records for the selected county I have looked at using a form but it seems not to work unless the form submit button is clicked, the problem is that there are several links on the menu to show thing like.. records New Records Records Sorted By Most Viewed UN Read Records My Records Records Added Since Last Visit I want the page to show the relevant records for the county selected whichever link is clicked. Any one got any ideas
VIEWS ON THIS POST

174

Posted on:

Friday 26th October 2012
View Replies!

Problem in selecting multiple items in ListBox

In my code if I select single item in listbox then it works fine on form submit but if I select multiple values then on form submit it doesn't display the data in listbox. Code:
VIEWS ON THIS POST

205

Posted on:

Friday 26th October 2012
View Replies!

Can asp narrow down errors when selecting drop down boxes?

hi, I have a scenario and not sure if asp can do it. example, I have 3 drop down boxes n a page. 1st box contains all countries, 2nd box contains all locations in that country selected from the 1st box 3rd box contains all items at that particular location selected from the 2nd box i hope im not confusing anyone. would like to know if it can be done and how
VIEWS ON THIS POST

218

Posted on:

Friday 26th October 2012
View Replies!

how can i populate many fields by selecting a single value from COMBO BOX

, i should populate all the fields in the form just by selecting a single value in combo box. for example, my combo box contains client id s, and if i select an id, it should retreive the client name, address, coiuntry, city , fax etc. how is this possible\t if i use propety, i can change only a single value. kindly help friends
VIEWS ON THIS POST

200

Posted on:

Friday 26th October 2012
View Replies!

How to populate "chapter" table fieldname (MSAccess 2000) by selecting book from drop

I have 2 dropdowns (or listboxes). 1 is for list of books called "book_title". I use a different recordType for value. My table ID | book_title | recordType | chapter | text_data My 2nd dropdown is empty. I don't know what I forgot. http://n.1asphost.com/wheelofgod/dropdownduo.asp Code:
VIEWS ON THIS POST

154

Posted on:

Friday 26th October 2012
View Replies!

selecting single character from a string

I have a page that will display a list of locations from an SQL DB. Users need to be able to sort and/or search these locations by industry Each location has a 4 character desgnation, the 3rd character of which indicates industry. How do I query the DB in an ASP page to recognize ONLY the third character in the string
VIEWS ON THIS POST

150

Posted on:

Friday 26th October 2012
View Replies!

logic needed, for selecting rs

Example : If the route runs between 12:15 AM - 07:30 AM... And some drivers availability is as follow.. Case 1) 01:00 AM - 5:30 AM Or Case 2) 11:00 PM - 02:00 AM Or Case 3) 04:00 AM - 9:00 AM Or Case 4) 11:30 PM - 08:00 AM You are given me the answer for case 1...However... My query should be able to pick these case2,3,and 4 because all these cases either fall between the routes run time or cover the route totally like in case 4.... For case 2 if difference between case2's end time and route's start time is greater than > 30 mins, it should be considered. For case 3 if difference between case3's start time and route's end time is greater than > 30 mins, it should be considered. I need to modify my query as above example...how will I do that Code: SELECT * FROM myTbl WHERE PERSON_ID=[pid] AND ( start_datetime between [datetime1] and [datetime2] OR end_datetime between [datetimte1] and [datetime2] )
VIEWS ON THIS POST

161

Posted on:

Friday 26th October 2012
View Replies!