Shawn, that's brilliant - thank you very much. Is it possible to stop the string being in ascending numerical order. The order it comes up with them is fine - or is that not possible with the code that I'm using? I've chopped it down as much as my knowledge allows. (and hopefully I haven't cut too much off!)
intLow = 1 'lowest number allowed intHigh = totalnum 'highest number allowed intHowManyNumbers = 6 'number of numbers to return intHowManySets = 1 'number of sets of numbers to return FOR l = 1 to intHowManySets intLoopNumber = intHowManyNumbers - 1 Redim initialArray(intLoopNumber) 'Redim finalArray(intLoopNumber) FOR i = 0 to UBOUND(initialArray) bDuplicate = False RANDOMIZE TIMER intNewNumber = Int((intHigh - intLow + 1) * RND + intLow) 'check for duplication FOR h = 0 to UBOUND(initialArray) IF CInt(initialArray(h)) = CInt(intNewNumber) THEN bDuplicate = True i = i - 1 EXIT FOR END IF NEXT IF NOT(bDuplicate) THEN initialArray(i) = intNewNumber bDuplicate = False else 'intLoopNumber = intLoopNumber + 1 END IF NEXT FOR i = 0 to UBOUND(initialarray) slottery = slottery & initialarray(i) IF i < UBOUND(initialarray) THEN slottery = slottery & "," END IF NEXT NEXT lottery = slottery END FUNCTION Alex -----Original Message----- From: Shawn K. Hall [mailto:[EMAIL PROTECTED] Sent: 30 August 2004 22:33 To: [EMAIL PROTECTED] Subject: RE: [ASP] SQL statements... Hi Alex, > sql="SELECT * FROM adquestbank WHERE qid IN (" & lottery & ")" > RESPONSE.WRITE sql > ... > comes up with: > 4,5,7,8,10,11SELECT * FROM adquestbank WHERE qid IN () ... > But why are the numbers coming up at the begining of the line and not > in the brackets as required for the request? Because you're not returning the value with the Lotery Function, you're "response.write"ing it: '// ======================================================== FUNCTION LOTTERY ... Response.Write(initialarray(i)) ... Response.Write(",") ... END FUNCTION '// ======================================================== Instead, build them into a string like this: sLottery = sLottery & initialarray(i) and sLottery = sLottery & "," Then return it using: LOTTERY = sLottery Regards, Shawn K. Hall http://ReliableAnswers.com/ '// ======================================================== Join my war on technology...send me a FAX. -- Mark Russell ------------------------ Yahoo! Groups Sponsor --------------------~--> $9.95 domain names from Yahoo!. Register anything. http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/17folB/TM --------------------------------------------------------------------~-> --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [EMAIL PROTECTED] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM --------------------------------------------------------------------~-> --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [EMAIL PROTECTED] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
