Breakfast MenusLunch MenusDrinks and Snacks Menu
Your LunchHow to OrderLate OrdersContract CateringDownload Forms <% Function produceChoiceRadioButton(inWorkingLunch, inChoiceOf, inHeader) if inWorkingLunch <> "" then 'Query and create recordset sqlQuery2 = "SELECT * FROM " & inChoiceOf& " WHERE " & inWorkingLunch & " = Yes" Set rsDB2 = Server.CreateObject("ADODB.Recordset") Set rsDB2 = dcnDB.Execute(sqlQuery2) if NOT rsDB2.eof then %>
Please choose your <%=inHeader%>
<% end if dim counter counter = 0 dim itemSelected itemSelected = "" Do Until rsDB2.EOF counter = counter + 1 if counter = 1 then itemSelected = "CHECKED" else itemSelected = "" end if %> value = "<%=rsDB2("Id")%>" name = "<%=inChoiceOf%><%=rsDB("p.Id")%>"> <%=rsDB2("Title")%> <%if rsDB2("Description") <> "" then%> - <%=rsDB2("Description")%> <%end if%>
<% rsDB2.MoveNext Loop end if End Function %>
    <% ' ADO Constant. Dont change this Const adCmdText2 = &H0001 dim favoriteRandom1 dim favoriteRandom2 dim favoriteRandom3 dim favoriteRandom4 dim favoriteRandom5 dim favoriteRandom6 favoriteRandom1 = -1 favoriteRandom2 = -1 favoriteRandom3 = -1 favoriteRandom4 = -1 favoriteRandom5 = -1 favoriteRandom6 = -1 ' Connection string and SQL statement Dim query2, connStr2 connStr2 = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("ocm/cateringdb.mdb") counter = 1 while counter <= 6 query2 = "select DISTINCT ProductName, highlight, ID from Products WHERE Category=1 AND Highlight = true and ProductName not in ('" & favoriteRandom1 & "','" & favoriteRandom2 & "','" & favoriteRandom3 & "','" & favoriteRandom4 & "','" & favoriteRandom5 & "','" & favoriteRandom6 & "')" ' Opening database Dim rs2 Set rs2 = Server.CreateObject("ADODB.Recordset") rs2.Open query2, connStr2, 3, , adCmdText2 ' Generating random number from total number of records Dim intRnd2 Randomize Timer intRnd2 = (Int(RND * rs2.RecordCount)) if rs2.RecordCount > 0 then ' Now moving the cursor to random record number rs2.Move intRnd2 if counter = 1 then favoriteRandom1 = rs2("ProductName") end if if counter = 2 then favoriteRandom2 = rs2("ProductName") end if if counter = 3 then favoriteRandom3 = rs2("ProductName") end if if counter = 4 then favoriteRandom4 = rs2("ProductName") end if if counter = 5 then favoriteRandom5 = rs2("ProductName") end if if counter = 6 then favoriteRandom6 = rs2("ProductName") end if ' Showing the random statement Response.Write "
  • " & rs2("ProductName") & "
  • " ' Closing the database end if counter = counter + 1 rs2.Close Set rs2 = Nothing wend %>