What's Wrong With This Code?

Results 1 to 4 of 4

Thread: What's Wrong With This Code?

  1. #1
    VBGuy Guest

    Default What's Wrong With This Code?

    The following code (or something very similar to it) was working fine when I first set it up. It stopped working without my having made a single change. I&#039;ve since tried to "repair" it but it remains essentially what it was when it "broke".<BR><BR>I&#039;d appreciate any helpful suggestions...<BR><BR>VBGuy<BR><BR>*** FROM THE CALLING HTML PAGE:<BR><BR>&#060;form action="list_subscriber.asp" method="post" name="list_subscriber" id="list_subscriber"&#062;<BR>&#060;TABLE WIDTH="610" BORDER="0"&#062;<BR>&#060;tr&#062;&#060;td colspan=2&#062;<BR>&#060;CENTER&#062;<BR>&#060;B&# 062;&#060;FONT FACE="Arial, Helvetica" SIZE="+1" COLOR="777777"&#062;Join our mailing list!&#060;/FONT&#062;&#060;/B&#062;&nbsp;&nbsp;Enter your email address below &amp; click the ‘Join List’ button:<BR>&#060;/CENTER&#062;<BR>&#060;/td&#062;&#060;/tr&#062;<BR>&#060;TR&#062;&#060;TD ALIGN="center"&#062;<BR>&#060;input type="text" name="e_mail" id="e_mail"&#062;<BR>&#060;/TD&#062;&#060;TD VALIGN="top"&#062;<BR>&#060;input type="image" name="submit" src="images/subscribe_button.gif" alt="Click here to join our mailing list!" width="88" height="31" border="0"&#062;<BR>&#060;/TD&#062;&#060;/tr&#062;<BR>&#060;tr&#062;&#060;TD COLSPAN="2" VALIGN="top"&#062;<BR>&#060;CENTER&#062;<BR>You will be notified of new postings at the Sample.com site and related news.<BR><BR>&#060;FONT SIZE="-1"&#062;(&#060;FONT COLOR="Red"&#062;Or just send an e-mail directly to &#060;A HREF="mailto:list-subscribe@samble.com"&#062;list-subscribe@trueorigin.org&#060;/A&#062;&#060;/FONT&#062;)&#060;/FONT&#062;<BR>&#060;/CENTER&#062;<BR>&#060;/TD&#062;&#060;/tr&#062;<BR>&#060;/table&#062;<BR>&#060;/form&#062;<BR><BR>*** THE CALLED ASP PAGE:<BR><BR>&#060;html&#062;<BR>&#060;HEAD&#062;< BR>&#060;TITLE&#062;- List Subscription -&#060;/TITLE&#062;<BR>&#060;link rel="stylesheet" href="tomain2.css" type="text/css"&#062;<BR>&#060;/HEAD&#062;<BR><BR>&#060;script language="JavaScript" type="text/javascript"&#062;<BR>if (screen.width &#062; 1023)<BR>document.write(&#039;&#060;BODY BGCOLOR="#000000"&#062;&#039;)<BR>else<BR>document .write(&#039;&#060;BODY BGCOLOR="#ffffff"&#062;&#039;)<BR>&#060;/script&#062;<BR><BR>&#060;table width="758" border="0" align="center" bgcolor="#FFFFFF"&#062;&#060;TR&#062;&#060;TD&#062 ;<BR><BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;%<BR>Function BuildConnString()<BR><BR> &#039;The following line will derive the absolute file path to the database<BR> &#039;This will be used by the Connection string<BR> <BR> Dim DBFilePath<BR> DBFilePath=Replace(Request.ServerVariables("APPL_P HYSICAL_PATH"),"html\","database o_subscribers.mdb")<BR> <BR> &#039;The following line builds the connection string for the database<BR> <BR> Dim ConnString <BR> ConnString="Provider=Microsoft.Jet.OLEDB.4.0;" & _<BR> "Data Source=" & DBFilePath<BR><BR> BuildConnString=ConnString<BR><BR>End Function<BR>%&#062;<BR><BR><BR>&#060;%<BR>Sub InsertAddress<BR><BR> Dim theConn <BR><BR> Set theConn=Server.CreateObject("ADODB.Connection")<BR > <BR> theConn.Open BuildConnString<BR> <BR> Dim theSQL<BR><BR> Dim SubscriberAddress<BR> If Len(Request.Form("e_mail")) &#062; 0 Then<BR> SubscriberAddress=Request.Form("e_mail")<BR> <BR> theSQL = "select email,confirmed from addresses where email = &#039;" & SubscriberAddress & "&#039;" <BR> Dim theRS<BR> <BR> Set theRS=Server.CreateObject("ADODB.Recordset") <BR> <BR> theRS.open theSQL, theConn<BR> <BR> If theRS.EOF and theRS.BOF Then<BR> &#039; do nothing<BR> Else<BR> &#039; the address is already in the list<BR> Response.Write "&#060;blockquote&#062;&#060;blockquote&#062;&#060 ;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;" & _<BR> "&#060;font face=&#039;Arial,Helvetica,sans-serif&#039; size=&#039;+1&#039;&#062;&#060;b&#062;" & _<BR> "&#060;center&#062;The email address " & chr(34) & SubscriberAddress & chr(34) & _<BR> " is already in the list" & _<BR> IIF(theRS!confirmed = "1","",", but confirmation email response has not been received") & _<BR> ".&#060;/center&#062;&#060;/b&#062;&#060;/font&#062;" & _<BR> "&#060;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;" & _<BR> "&#060;FORM Name=frmLogin Method=Post Action=&#039;javascript:history.go(-1);&#039;&#062;" & _<BR> "&#060;hr width=&#039;80%&#039;&#062;<BR>&nbsp;<BR>&nbsp;<BR >&nbsp;<BR>&nbsp;<BR>&nbsp;" & _<BR> "&#060;Table Width=&#039;50%&#039; Align=center border=&#039;0&#039;&#062;" & _<BR> "&#060;TR&#062;&#060;TD align=center&#062;" & _<BR> "&#060;Input Type=Submit Value=&#039; OK &#039;&#062;" & _<BR> "<BR><BR>&nbsp;&#060;/TD&#062;&#060;/TR&#062;&#060;/Table&#062;" & _<BR> "&#060;/Form&#062;&#060;/blockquote&#062;&#060;/blockquote&#062;"<BR> theRS.Close<BR> Set theRS = Nothing<BR> theConn.Close<BR> Set theConn = Nothing<BR> Exit Sub<BR> End If<BR> Else<BR> Response.Write "&#060;blockquote&#062;&#060;blockquote&#062;&#060 ;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;" & _<BR> "&#060;font face=&#039;Arial,Helvetica,sans-serif&#039; size=&#039;+1&#039;&#062;&#060;b&#062;" & _<BR> "&#060;center&#062;No valid email address was supplied.&#060;/center&#062;&#060;/b&#062;&#060;/font&#062;" & _<BR> "&#060;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;" & _<BR> "&#060;FORM Name=frmLogin Method=Post Action=&#039;javascript:history.go(-1);&#039;&#062;" & _<BR> "&#060;hr width=&#039;80%&#039;&#062;<BR>&nbsp;<BR>&nbsp;<BR >&nbsp;<BR>&nbsp;<BR>&nbsp;" & _<BR> "&#060;Table Width=&#039;50%&#039; Align=center border=&#039;0&#039;&#062;" & _<BR> "&#060;TR&#062;&#060;TD align=center&#062;" & _<BR> "&#060;Input Type=Submit Value=&#039; OK &#039;&#062;" & _<BR> "<BR><BR>&nbsp;&#060;/TD&#062;&#060;/TR&#062;&#060;/Table&#062;" & _<BR> "&#060;/Form&#062;&#060;/blockquote&#062;&#060;/blockquote&#062;"<BR> Exit Sub<BR> End If<BR> <BR><BR> theSQL = "insert into addresses values (&#039;" & SubscriberAddress & "&#039;,&#039;&#039;,&#039;&#039;,&#039;&#039;)"<B R><BR> theConn.Execute TheSQL<BR> <BR> theConn.Close<BR> Set theConn = Nothing<BR> <BR> Dim objNewMail<BR> Set objNewMail = Server.CreateObject("CDONTS.NewMail")<BR> objNewMail.To = SubscriberAddress<BR> objNewMail.Bcc = "list-subscribe@sample.com"<BR> objNewMail.From = "list-subscribe@sample.com"<BR> objNewMail.Body = "Greetings," & vbcrlf & vbcrlf & _<BR> "The email address " & chr(34) & SubscriberAddress & chr(34) & _<BR> " has been submitted to the sample.com website to receive " & _<BR> "notifications of updates to the website." & vbcrlf & vbcrlf & _<BR> "TO CONFIRM your wish to receive sample.com updates, please reply to " & _<BR> "this email message." & vbcrlf & vbcrlf & _<BR> "TO CANCEL the submission, please reply to this email message, with " & _<BR> "the word " & chr(34) & "REMOVE" & chr(34) & " in the Subject." & _<BR> vbcrlf & vbcrlf & "Thank You," & vbcrlf & vbcrlf & _<BR> "Sample.com"<BR> <BR> objNewMail.Send , , "RESPONSE REQUIRED - Sample.com Update Confirmation", , 2<BR> <BR> Response.Write "&#060;blockquote&#062;&#060;blockquote&#062;&#060 ;blockquote&#062;&#060;blockquote&#062;&#060;p&#06 2;&nbsp;&#060;/p&#062;&#060;p&#062;&nbsp;&#060;/p&#062;" & _<BR> "&#060;font face=&#039;Arial,Helvetica,sans-serif&#039; size=&#039;+1&#039;&#062;" & _<BR> "The supplied email address (" & SubscriberAddress & ") has been submitted.<BR><BR>" & _<BR> "A confirmation request will be emailed to the " & _<BR> "submitted address.<BR>&#060;u&#062;You must reply to the " & _<BR> "confirmation email before the address will be added" & _<BR> "to the list of subscribers.&#060;/u&#062;&#060;/font&#062;" & _<BR> "&#060;FORM Name=frmLogin Method=Post Action=&#039;javascript:history.go(-1);&#039;&#062;" & _<BR> "&#060;hr width=&#039;80%&#039;&#062;" & _<BR> "&#060;Table Width=&#039;50%&#039; Align=center border=&#039;0&#039;&#062;" & _<BR> "&#060;TR&#062;&#060;TD align=center&#062;" & _<BR> "<BR>&#060;Input Type=Submit Value=&#039; OK &#039;&#062;" & _<BR> "<BR><BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>& nbsp;" & _<BR> "<BR><BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>& nbsp;" & _ <BR> "<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>&nbsp ;&#060;/TD&#062;&#060;/TR&#062;&#060;/Table&#062;" & _<BR> "&#060;/Form&#062;&#060;/blockquote&#062;&#060;/blockquote&#062;&#060;/blockquote&#062;&#060;/blockquote&#062;" <BR><BR> Set objNewMail = Nothing<BR> <BR>End Sub <BR><BR>InsertAddress<BR> <BR>%&#062;<BR><BR>&#060;/td&#062;&#060;/tr&#062;&#060;/table&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;

  2. #2
    Join Date
    Dec 1969
    Posts
    2,092

    Default Too long

    Your post is too long and you haven&#039;t done any DEBUG<BR><BR>Now please Make some Response.Write&#039;s until you find what your error is <BR><BR>Plus I notice in *** THE CALLED ASP PAGE: <BR>The first line should be &#060;%@ Language=VBScript %&#062; in your asp page.<BR>

  3. #3
    Forum Police Guest

    Default You've GOT to be kidding me

    If you want to get a response you&#039;ll need to do two things.<BR><BR>1. Tell us HOW it&#039;s not working. "It stopped working" and "It broke" don&#039;t tell us anything.<BR><BR>2. Narrow it down. Look at how much code you posted! How many people do you think want to read through all that, especially without knowing what they&#039;re looking for? Try to figure out which *part* of the code is causing problems, and just post what is relevant to that part.<BR><BR>Maybe then someone will be able to help you.<BR><BR>Sincerely,<BR>The Forum Police

  4. #4
    VBGuy Guest

    Default Would I kid about a thing like this?

    Sorry, I just figured maybe some ASP wiz might see a glaring mistake. Like I said, it worked fine, and now it doesn&#039;t. I thought I narrowed it down to a problem connecting to the database, but the ADO is the one part I do know better than any of the rest and my ISP assures me that no server settings have been changed and that the DSN (I&#039;ve tried it both with and without) is working.<BR><BR>So someone could start there, I guess, and tell me why my connection to my database (as coded) would work one day and not the next. Since all I get is a "Page can&#039;t be displayed" error it&#039;s kind of hard for me to know how to debug -- a response.write doesn&#039;t produce anything.<BR><BR>VBGuy


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •