<%
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 "
"
' Closing the database
end if
counter = counter + 1
rs2.Close
Set rs2 = Nothing
wend
%>
Terms and Conditions
<%
'Declare Variables
Dim dcnDB 'As ADODB.Connection
Dim rsDB 'As ADODB.Recordset
Dim sqlQuery 'As String
'Find path of database file
filePath = Server.MapPath("ocm/cateringdb.mdb")
'Open Database Connection
Set dcnDB = Server.CreateObject("ADODB.Connection")
'dcnDB.Open "system" '- This is for an ODBC Datasource (if set up) or
' use the below code for opening a Access 2000 DB
dcnDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&filePath
dcnDB.Open
'sqlQuery = "SELECT * FROM Products p,Brand b WHERE b.id = p.brand and p.Brand = " & BRANDNAME
'Query and create recordset
sqlQuery = "SELECT * FROM Products p, SubCategory s WHERE p.Category = 1 AND p.Subcategory = s.ID ORDER BY s.ID, p.Price, p.ProductName"
Set rsDB = Server.CreateObject("ADODB.Recordset")
Set rsDB = dcnDB.Execute(sqlQuery)
%>
<%
Dim rsDB2 'As ADODB.Recordset
Dim sqlQuery2 'As String
%>
<%
Dim currentsubcategory
Dim lastsubcategory
currentsubcategory = ""
lastsubcategory = ""
%>
<% Do Until rsDB.EOF
currentsubcategory = rsDB("s.ID")
%>
<%
lastsubcategory = currentsubcategory
rsDB.MoveNext
Loop
%>
<%
'Close Connection and clean up
dcnDB.Close
%>