<%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit %><% On Error Resume Next ' Variable declaration Dim rst 'recordset Dim strSQL 'SQL string Dim ConnectionString ' Constants for opening the connection Const OpenStatic = 3 Const LockReadOnly = 1 Const CmdText = 1 ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("database/Events.mdb")& ";User ID=;Password=;" Set rst = Server.CreateObject("ADODB.Recordset") ' get all the state names first, and put into an array sorted alphabetically strSQL = "SELECT * FROM tblStates ORDER BY State" rst.Open strSQL, ConnectionString, OpenStatic, LockReadOnly, CmdText Dim aArray, RowCount aArray = rst.GetRows RowCount = UBound(aArray, 2) ' then get all the calendar events rst.Close strSQL ="SELECT * FROM tblComingEvents ORDER BY State, DateStart" rst.Open strSQL, ConnectionString, OpenStatic, LockReadOnly, CmdText %> Quilt Shows and Events - The National Quilting Association, Inc. (NQA)

Quilting Events Calendar


<% ' make state pointers at top of page Dim stateAB, i For i = 0 to RowCount stateAB = aArray (2, i) stateNM = aArray (1, i) Response.Write(" " + stateNM + " ~ ") Next %>

<% ' display events by state Const COLUMN_COUNT = 2 Dim column, c, stateNM, s, displayState, Eaddress, Waddress column = 0 ' initialize counter displayState = 0 Do While Not rst.EOF For i = 0 to RowCount rst.MoveFirst stateNM = aArray (1, i) stateAB = aArray (2, i) if displayState = 0 then Response.Write ("") displayState = 1 column = 0 end if do until rst.EOF if rst("State") = stateAB then if column = 0 then Response.Write "" end if %> <% column = column + 1 if column = COLUMN_COUNT Then Response.Write "" & vbNewLine column = 0 ' start over! end if end if rst.MoveNext Loop displayState = 0 Next Loop ' Cleanup objects rst.Close Set rst = Nothing %>

" + stateNM + "

<%=rst("City")%>...<%=rst("DisplayDates")%>
<% if rst("Name") <> "" then Response.Write("" + rst("Name") + "
") if rst("Sponsor") <> "" then Response.Write("Sponsor: " + rst("Sponsor") + "
") if rst("Location") <> "" then Response.Write("Location: " + rst("Location") + "
") if rst("Address") <> "" then Response.Write(rst("Address") + "
") if rst("City") <> "" then Response.Write(rst("City") + ", " + rst("State")) if rst("Zip") <> "" then Response.Write(" " + rst("Zip")) Response.Write("
") if rst("Comments") <> "" then Response.Write("Comments: " + rst("Comments") + "
") if rst("Contact1") <> "" then Response.Write("Contact: " + rst("Contact1") + "
") if rst("Contact1Address") <> "" then Response.Write(rst("Contact1Address") + "
") if rst("Phone1") <> "" then Response.Write(" " + rst("Phone1") + "
") Eaddress = rst("Email1") if Eaddress <> "" then Response.Write("" + Eaddress + "
") if rst("Contact2") <> "" then Response.Write("Contact: " + rst("Contact2") + "
") if rst("Contact2Address") <> "" then Response.Write(rst("Contact2Address") + "
") if rst("Phone2") <> "" then Response.Write(" " + rst("Phone2") + "
") Eaddress = rst("Email2") if Eaddress <> "" then Response.Write("" + Eaddress + "
") Waddress = rst("WebSite") if Waddress <> "" then Response.Write("Website: " + Waddress + "
")%>


Add An Event