<% @LANGUAGE="VBSCRIPT" %> <% if request("addcity") = 1 then Set adoCon = Server.CreateObject("ADODB.Connection") adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("mostordered.mdb") Set rsCityCheck = Server.CreateObject("ADODB.Recordset") CityName = request("city") State = request("state") sCityCheck = "SELECT CityID FROM CITIES WHERE CityName = '" & CityName & "' AND StateID = " & State rsCityCheck.Open sCityCheck, adoCon 'rsCityCheck.MoveFirst if not rsCityCheck.EOF and not rsCityCheck.BOF then Statement = "Sorry, the city you are trying to add already exists in our database." else Set rsAddCity = Server.CreateObject("ADODB.Recordset") Set rsUpdateStatus = Server.CreateObject("ADODB.Recordset") sAddCity = "INSERT INTO Cities(CityName, StateID) VALUES('" & CityName & "','" & State & "')" rsAddCity.Open sAddCity, adoCon sUpdateState = "UPDATE States SET HasCities = 1 WHERE StateID = " & State rsUpdateStatus.Open sUpdateState, adoCon Statement = "Thank you for your submission! " & CityName & " has been added to our database! Please feel free to submit your favorite drinks to our database for your city." end if %> .: www.MostOrdered.com :.



City Added

<%=Statement%>
 
© Copyright 2003, www.MostOrdered.com
<% else Set adoCon = Server.CreateObject("ADODB.Connection") adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("mostordered.mdb") Set rsStateList = Server.CreateObject("ADODB.Recordset") Set rsStateCount = Server.CreateObject("ADODB.Recordset") sGetStateList = "SELECT StateID, StateAbbr, State FROM States ORDER BY State" rsStateList.Open sGetStateList, adoCon sGetStateCount = "SELECT COUNT(State) FROM States" rsStateCount.Open sGetStateCount, adoCon %> .: www.MostOrdered.com :.



Add City

Use this form to add your city to our database!
State:
City:
 
© Copyright 2003, www.MostOrdered.com
<% end if %>