sql - How can I shuffle a bidimensional array in VBscript? -


i need shuffle bidimensional array in vbscript, told me can use newid() in sql query, i'm not using sql server. i'm seeing on web lbound , ubound, don't understand much. can me understand or tell me best way it? in advance. code far.

sql = "select * questions"  recordset.open sql, connection  if not recordset.eof     nquestions = recordset.recordcount     questions = recordset.getrows(nquestions, 0)     if isarray(questions)     (...)     end if end if 

to answer part of question relating ubound , lbound:

lbound , ubound lower , upper bounds of array. specify 2 arguments, array name , dimension want count, instance:

dim myarr(10, 8) dim firstdim, seconddim firstdim = ubound(myarr, 1)  ' 1 here requests size of first dimension of array seconddim = ubound(myarr, 2) '... , this, second. 

here, firstdim hold size of first dimension of array (i.e. 10), , seconddim second (i.e. 8).

obviously lbound works lowest dimension, though used arrays base other usual 0 (possibly com objects).

-- edit --

to expand further, can around using function in access, slow process dramatically.

you'll need create query select data. select table contains questions. drop of columns need questions grid @ bottom. in field box in right column of grid type like:

randomiser: rnd([questionid]) 

(obviously questionid being unique id of questions).

this give list of questions random number (from 0 1) in last column. change sort order column ascending, , can add top clause query give specific number of questions.

because argument specified each row in rnd function must execute every time, unlike putting rnd(). notice, also, if run query , click 1 of randomised fields number changes.

one thing bear in mind here if have empty (null) value in 1 of fields sort fail.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -