<%
Dim sDB, sPath, sDSNDir, sDSNFil, sDefDir, sDSN, sScriptDir
sDB = "database/prefix_table.xls"
set conntemp=Server.CreateObject("adodb.connection")
cnpath="DBQ=" & server.mappath(sDB)
conntemp.Open "DRIVER={Microsoft Excel Driver (*.xls)}; " & cnpath
condition = request.QueryString("key")
if (condition = "") then
sqlstr = "select * from [prefix$] where left(country,1) = 'A' order by country"
else
sqlstr = "select * from [prefix$] where left(country,1) = '"&condition&"' order by country"
end if
set rs = conntemp.execute(sqlstr)
%>
<%if not left(rs("country"),1)=left(last_item,1) then response.write("") end if %><%if not rs("country")=last_item then response.write(rs("country")) end if%>
<%if not rs("country")=last_item then response.write(rs("country_code")) end if%>
<%=rs("area")%>
<%=rs("area_code")%>
<%
last_item = rs("country")
rs.MoveNext
if not rs.eof then
%>
<%if not left(rs("country"),1)=left(last_item,1) then response.write("") end if %><%if not rs("country")=last_item then response.write(rs("country")) end if%>
<%if not rs("country")=last_item then response.write(rs("country_code")) end if%>
<%=rs("area")%>
<%=rs("area_code")%>
<%
last_item = rs("country")
rs.MoveNext
end if
Wend
%>