
<%
	Dim SQL1
	Dim Conn
	Dim RS
	Dim sState, sCounty, sLat, sLon, sSearchSize, sSearch
	
	sSearch = Request("sSearch")
	sState = Request("sState")
	sCounty = Request("sCounty")
	sLat = Request("sLat")
	sLon = Request("sLon")
	sSearchArea = Request("sSearchSize")
	
	'Debug Code
	'Response.Write "<TD>State: " & sState & "</TD>"
	'Response.Write "<TD>County: " & sCounty & "</TD>"
	'Response.Write "<TD>Lat: " & sLat & "</TD>"
	'Response.Write "<TD>Lon: " & sLon & "</TD>"
	'Response.Write "<TD>Search Size: " & sSearchSize & "</TD>"

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={SQL Server};SERVER=WEBSRV01;UID=web;pwd=w3bs1t3;DATABASE=AVANTE"

SQL1 = "[Avante].[dbo].[Find_Business_Local_Dist] '" & sState & "','" & sCounty & "','" & sLat & "','" & sLon & "','" & sSearchSize & "'"
'Response.Write "SQL1: " & SQL1
SQL2 = "[Avante].[dbo].[Find_Business_Local_Dist] @State=" & sSearch
'Response.Write "SQL2: " & SQL2

Set RS = Conn.Execute (SQL2)
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<TABLE>
<%

	Dim sFeatureName, sFeatureType, sFeatureID, sDist
	
if RS.EOF then
	Response.Write "<br>"
	Response.Write "<br>"
	Response.Write "<p></p>"
	Response.Write "<Center><h1> No Data Available </h1></center>"

End if

Set sName=rs("Name")
Set sCity=rs("City")
Set sPhone=rs("PhoneNum")
Set sWeb=rs("Web")
Set sDist=rs("Dist")
Set sID=rs("Bus_Id")
'Start Text for alternating colored rows
	Dim RowColor
	RowColor = 0
' End Test for Colored Rows
Do while not rs.eof
'Start Text for alternating colored rows
	if rowcolor = 0 then
		Response.Write "<TR bgColor=white>"
		RowColor = 1
	Else
		Response.Write "<TR bgColor=lightblue>"
		RowColor = 0
	End if
' End Test for Colored Rows (note change in first response.write)	
	Response.Write "<TD><FONT face='Verdana, Arial, Helvetica, sans-serif' size=2><C>"
	Response.Write "<a href=Disp_Business_Detail.asp?BusID=" 
	Response.Write sID &" Target=ResultsFrame>" & sName & "</a></C></td>"
	Response.Write "<td><FONT face='Verdana, Arial, Helvetica, sans-serif' size=2>"
	Response.Write sCity & "&nbsp;</td>"
	
	Response.Write "<td><FONT face='Verdana, Arial, Helvetica, sans-serif' size=2>"
	Response.Write sPhone & "&nbsp;</td>"
	
	Response.Write "<td><FONT face='Verdana, Arial, Helvetica, sans-serif' size=2>"
	Response.Write sWeb & "&nbsp;</td>"
	
	Response.Write "<td><FONT face='Verdana, Arial, Helvetica, sans-serif' size=2>"
	Response.Write sDist & " mi</td>"
	Response.Write "</tr>"
	rs.movenext
Loop
%>
</TABLE>
</BODY>
</HTML>
