Find a Dealer
<%@ language="VBSCRIPT" %> <% dim SQL_1,SQL_2, path, recCount, state_val, email_1, Do_Not_Email_Dealer SQL_1 = "select email, zip, Do_Not_Email_Dealer from solar where service_state='%state' order by zip" SQL_1 = replace(SQL_1,"%state",request.QueryString("state")) SQL_2 = "select state_lookup.state_desc, solar.* from state_lookup left JOIN solar ON solar.service_state = state_lookup.state_code order by state_lookup.state_desc, solar.company" Set objConn = Server.CreateObject("ADODB.Connection") dbstring="driver={Microsoft Access Driver (*.mdb)};dbq=" &server.MapPath("statelist.mdb")&";readonly=0" objConn.Mode = 3 objConn.Open dbstring Set objRS = Server.CreateObject("ADODB.Recordset") objRS.ActiveConnection = objConn objRS.CursorType = 3 objRS.LockType = 2 objRS.Source = SQL_1 objRS.Open recCount = objRS.recordCount If recCount <> 0 then email_1 = objRS("email") Do_Not_Email_Dealer = objRS("Do_Not_Email_Dealer") if(not(isnull(email_1)) and isnull(Do_Not_Email_Dealer)) then call getFormVals(email_1) else call getFormVals(null) end if else call getFormVals(null) end if objRS.Close objRS.Source = SQL_2 objRS.Open call getStates(objRS.GetRows()) objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing sub getFormVals(mm_addy) dim EmailStr, FormFields, FormValue, FileStr, mydate FormFields = array("name" ,"address","city","state","zip","phone","from", "ownpool","pooltype","Heated","HeaterType",+_ "HeatingCost","MonthsOfUse","FTemperature","HowDidYouFindUs") For each FormField in FormFields FormValue = trim(request.QueryString(FormField)) FileStr = FileStr &" , " & FormValue if FormValue <> "" then EmailStr = EmailStr & FormField &" : "& FormValue & vbNewLine end if next mydate = Date FileStr = FileStr & " , " & Month(myDate) & "/" & Day(myDate) & "/" & Year(myDate) call Send_Mail(mm_addy,EmailStr) 'call Open_File(FileStr & vbNewLine) end sub sub Send_Mail(sm_addy,sm_body) Const CdoMailFormatMime = 0 Const CdoBodyFormatText = 1 Const CdoMailImportance = 1 Set objMail = Server.CreateObject("CDONTS.NewMail") objMail.BodyFormat = CdoBodyFormatText objMail.MailFormat = CdoMailFormatMime objMail.Importance = CdoMailImportance objMail.To = "graf@grafweb.com,"& sm_addy objMail.Subject = "Solar Industries website submission" objMail.From = "graf@grafweb.com" objMail.Body = sm_body objMail.Send Set objMail = Nothing end sub sub Open_File(txt) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objStream= objFSO.openTextFile("e:\Graf\solarindustries_com\web\dealerlist\dealerlist.txt", 8, true) objStream.Write(txt) objStream.Close end sub sub getStates(alldata) cols = Ubound(alldata,1) rows= Ubound(alldata,2) prevState = "" FOR rowcounter = 0 TO rows state = alldata(0,rowcounter) service_state = alldata(1,rowcounter) if(prevState <> state) then state_str = "
Thank you for visiting our website and for your interest in our pool heating systems. We will forward your information to the Aquatherm/Solar Industries' dealer who can best serve your needs. You should be contacted in the next several days. If you have any questions in the mean time please feel free to contact us directly.800/227-7657
Thank you for visiting our website and for your interest in our pool heating systems. We will forward your information to the Aquatherm Industries dealer who can best serve your needs. You should be contacted in the next several days. If you have any questions in the mean time please feel free to contact us directly.800/535-6307Aquatherm Industries, Inc.1940 Rutgers University Blvd.Lakewood, NJ 08701Info@warmwater.com
") end if end if NEXT end Sub %>