Writing Preferences <% If Len(Request.Form("Search")) > 0 Then Response.Cookies("SearchCriteria")("5") = Request.Cookies("SearchCriteria")("4") Response.Cookies("SearchCriteria")("4") = Request.Cookies("SearchCriteria")("3") Response.Cookies("SearchCriteria")("3") = Request.Cookies("SearchCriteria")("2") Response.Cookies("SearchCriteria")("2") = Request.Cookies("SearchCriteria")("1") Response.Cookies("SearchCriteria")("1") = Request.Form("Search") End If %> Select Control with Preferences Buffered <% Option Explicit Response.Buffer = True Response.Write "Running query..." Dim conn Dim RSTotalSales set conn = server.createobject ("adodb.connection") conn.open "Sales", "sa", "YourPassword" set RSTotalSales = conn.Execute("select Sum(TotalAmount) as TotalSales " _ & "from Sales") Response.Write RSTotalSales("TotalAmount") %> Non Buffered <% Option Explicit Response.Buffer = False Response.Write "Running query..." Dim conn Dim RSTotalSales set conn = server.createobject ("adodb.connection") conn.open "Sales", "sa", "YourPassword" set RSTotalSales = conn.Execute("select Sum(TotalAmount) as TotalSales " _ & "from Sales") Response.Write RSTotalSales("TotalAmount") %> Expire <% Option Explicit Dim TheExpireDate If WeekDay(Date) = 1 then TheExpireDate = DateAdd("d", 5, Date) ElseIf WeekDay(Date) = 2 then TheExpireDate = DateAdd("d", 4, Date) ElseIf WeekDay(Date) = 3 then TheExpireDate = DateAdd("d", 3, Date) ElseIf WeekDay(Date) = 4 then TheExpireDate = DateAdd("d", 2, Date) ElseIf WeekDay(Date) = 5 then TheExpireDate = DateAdd("d", 1, Date) ElseIf WeekDay(Date) = 6 then TheExpireDate = DateAdd("d", 7, Date) Else TheExpireDate = DateAdd("d", 6, Date) End If Response.ExpiresAbsolute = TheExpireDate %> Client Connected <% Option Explicit Dim conn Dim RSTotals Response.Buffer = False set conn = server.createobject ("adodb.connection") conn.open "Sales", "sa", "yourpassword" set RSTotals = conn.Execute("select Sum(Sales) as TotalSales from Sales99") response.write RSTotals("TotalSales") & "

" If Response.IsClientConnected Then set RSTotals = conn.Execute("select Sum(Sales) as TotalSales from Sales98") response.write RSTotals("TotalSales") & "

" If Response.IsClientConnected Then set RSTotals = conn.Execute("select Sum(Sales) as TotalSales from Sales97") response.write RSTotals("TotalSales") & "

" End If End If %> Home Page <% Option Explicit Dim conn Dim RSMostPopular set conn = server.createobject ("adodb.connection") conn.open "ASPBook", "sa", "yourpassword" set RSMostPopular = conn.Execute("select * from C6Redirect") %> Building Select Control Redirect Code <% If not isempty(Request.Form("RedirectTo")) Then Response.Redirect Request.Form("RedirectTo") else Response.Redirect "../index.html" End If %> Progress <% Option Explicit Response.Buffer = True Dim DelayTime %> <% Response.Write "" Response.Flush DelayTime = Second(Time) + 10 If DelayTime > 59 Then DelayTime = DelayTime - 60 End If Do Until Second(Time) = DelayTime Loop Response.Write "" Response.Write "" Response.Flush DelayTime = Second(Time) + 5 If DelayTime > 59 Then DelayTime = DelayTime - 60 End If Do Until Second(Time) = DelayTime Loop Response.Write "" Response.Flush DelayTime = Second(Time) + 16 If DelayTime > 59 Then DelayTime = DelayTime - 60 End If Do Until Second(Time) = DelayTime Loop Response.Write "" Response.Write "" Response.Write "" Response.Flush DelayTime = Second(Time) + 1 If DelayTime > 59 Then DelayTime = DelayTime - 60 End If Do Until Second(Time) = DelayTime Loop Response.Write "" Response.Flush DelayTime = Second(Time) + 1 If DelayTime > 59 Then DelayTime = DelayTime - 60 End If Do Until Second(Time) = DelayTime Loop Response.Write "" Response.Flush DelayTime = Second(Time) + 1 If DelayTime > 59 Then DelayTime = DelayTime - 60 End If Do Until Second(Time) = DelayTime Loop Response.Write "" Response.Flush DelayTime = Second(Time) + 1 If DelayTime > 59 Then DelayTime = DelayTime - 60 End If Do Until Second(Time) = DelayTime Loop Response.Write "" Response.Write "" Response.Write "" Response.Flush %> Preferences Page <% Option Explicit Dim BackgroundColor Dim LargeFontColor Dim SmallFontColor Dim LargeFont Dim SmallFont If IsEmpty(Request.Form("Save")) Then If not len(Request.Cookies("Prefs")("BackgroundColor")) > 0 Then Response.Cookies("Prefs")("BackgroundColor") = "#FFFFFF" BackgroundColor = "#FFFFFF" Response.Cookies("Prefs")("LargeFontColor") = "#000000" LargeFontColor = "#000000" Response.Cookies("Prefs")("SmallFontColor") = "#000000" SmallFontColor = "#000000" Response.Cookies("Prefs")("LargeFont") = "Arial,Helvetica,Univers,Zurich BT" LargeFont = "Arial,Helvetica,Univers,Zurich BT" Response.Cookies("Prefs")("SmallFont") = "Times New Roman,Times,Times NewRoman" SmallFont = "Times New Roman,Times,Times NewRoman" Response.Cookies("Prefs").Expires = "2/2/2002" Else BackgroundColor = Request.Cookies("Prefs")("BackgroundColor") LargeFontColor = Request.Cookies("Prefs")("LargeFontColor") SmallFontColor = Request.Cookies("Prefs")("SmallFontColor") LargeFont = Request.Cookies("Prefs")("LargeFont") SmallFont = Request.Cookies("Prefs")("SmallFont") End If else Response.Cookies("Prefs")("BackgroundColor") = Request.Form("BackgroundColor") BackgroundColor = Request.Form("BackgroundColor") Response.Cookies("Prefs")("LargeFontColor") = Request.Form("LargeFontColor") LargeFontColor = Request.Form("LargeFontColor") Response.Cookies("Prefs")("SmallFontColor") = Request.Form("SmallFontColor") SmallFontColor = Request.Form("SmallFontColor") Response.Cookies("Prefs")("LargeFont") = Request.Form("LargeFont") LargeFont = Request.Form("LargeFont") Response.Cookies("Prefs")("SmallFont") = Request.Form("SmallFont") SmallFont = Request.Form("SmallFont") Response.Cookies("Prefs").Expires = "2/2/2002" end if %>