<%
' Connect to CMS database
Set conCMS = Server.CreateObject ("ADODB.Connection")
conCMS.Open getConnectionStringCMS()
' Connection to application database
Set con = Server.CreateObject ("ADODB.Connection")
con.Open getConnectionString()
' Get the URL of this page
i = 1
j = 1
while j <> 0
j = instr(j, Request.ServerVariables("URL"), "/")
If j <> 0 Then
i = j
j = j + 1
End If
Wend
sURL = Right(Request.ServerVariables("URL"), Len(Request.ServerVariables("URL")) - i)
' Determine the office id in the database that this page relates to,
' by examining the name of this page
Set rs = Server.CreateObject ("ADODB.Recordset")
sSQL = "SELECT * FROM Office WHERE PageName = '" & sURL & "'"
rs.Open sSQL, conCMS
If Not rs.EOF Then iOfficeId = rs("OfficeId").Value
rs.Close
%>