Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - 1 email - 2 loops
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

1 email - 2 loops

 Post Reply Post Reply
Author
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Topic: 1 email - 2 loops
    Posted: 15 October 2003 at 8:31am

I have a testing apps which has 2 loops: 1 is gathering the questions, 1 is gathering the answers, something like that:

<%
Set RSQ= MyConn.Execute("Select * from Interviuri_Intrebari where ID_Interviu = '"& Request.QueryString("int") &"'")
If not RSQ.Eof then
RSQ.MoveFirst
do
Response.Write RSQ("Question") & "<br>"
Set RSR = MyConn.Execute("Select * from Interviuri_Raspunsuri where ID_Intrebare = '"&RSQ("ID_Intrebare") &"' AND UserName = '"& Session("UserName") &"'")
If not RSR.Eof then
RSR.MoveFirst
do
Response.Write RSR("Raspuns") & "<br>"
RSR.MoveNext
Loop Until RSR.EOF
End IF
RSQ.MoveNext
Loop until RSQ.Eof
End if

Well, I need to send all the above test by email. How could I do that? I have tryed to make some strings out of them but to no avail...

Cristian Banu
Soft 4 web
Back to Top
vshriniwasan View Drop Down
Groupie
Groupie
Avatar

Joined: 17 December 2001
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote vshriniwasan Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2003 at 8:37am

You are doing too many things going on here... Just simply do two small loops..

Set RSQ= MyConn.Execute("Select * from Interviuri_Intrebari where ID_Interviu = '"& Request.QueryString("int") &"'")

Do until RSQ.eof

Set RSR = MyConn.Execute("Select * from Interviuri_Raspunsuri where ID_Intrebare = '"&RSQ("ID_Intrebare") &"' AND UserName = '"& Session("UserName") &"'")

Do until RSR.eof

your Stuff....

RSR.movenext
loop

RSQ.movenext
loop

Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2003 at 11:30am
Is not the problem. Is mailing the results.
Cristian Banu
Soft 4 web
Back to Top
vshriniwasan View Drop Down
Groupie
Groupie
Avatar

Joined: 17 December 2001
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote vshriniwasan Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2003 at 1:59pm

Can you add the mailing code so we can see. That way we can just see what is going on in the mailing code. What are you using... CDONTS or SMTP

Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2003 at 12:58am

<%
Set RSQ= MyConn.Execute("Select * from Interviuri_Intrebari where ID_Interviu = '"& Request.QueryString("int") &"'")
If not RSQ.Eof then
RSQ.MoveFirst
do
Response.Write RSQ("Question") & "<br>"
Set RSR = MyConn.Execute("Select * from Interviuri_Raspunsuri where ID_Intrebare = '"&RSQ("ID_Intrebare") &"' AND UserName = '"& Session("UserName") &"'")
If not RSR.Eof then
RSR.MoveFirst
do
Response.Write RSR("Raspuns") & "<br>"
RSR.MoveNext
Loop Until RSR.EOF
End IF
RSQ.MoveNext
Loop until RSQ.Eof
End if
' Send Mail Copy to Admin

 Dim objMail
 Dim strBody
       strBody = "<h2>Rezultatele testului pentru candidatul " & Session("UserName") & "</h2><br>"
    strBody = strBody & "La testul nr. " & Request.QueryString("int") &" candidatul " & Session("UserName") & " a raspuns in felul urmator:<br> "
    strBody = strBody & Here it should be the loops' results
  strBody = strBody & "Pentru a vizualiza reultatele candidatilor, trebuie sa va logati in contul dumneavoastra de pe site.<br>"
    strBody = strBody & "<a href = TestariOnline.rohttp://www.testarionline.ro>TestariOnline.ro</a>"
   
  Set objMail = Server.CreateObject("CDONTS.NewMail")

  objMail.From = "webmaster@mydomains.ro"
  objMail.Subject = "Rezultatul testului"
  Set rsTo = MyConn.Execute ("Select Email from Login where ID_Firma = "& Session("ID_Firma") & " AND Tip_Cont = ""Companie""")
  objMail.To = rsTo("email")
  objMail.Bcc = "myemail@mydomains.ro"
  objMail.BodyFormat =0
  objMail.MailFormat = 0
  objMail.Body = strBody

  objMail.Send
  On Error resume Next

  'You must always do this with CDONTS.
  set objMail = nothing
  ' End of Mail Function
  RSTo.close
  set RSTo = nothing
'___________________________________________________________ ____ 
RSQ.Close
RSR.Close
Set RSR = Nothing
Set RSQ = nothing
MyConn.Close
Set MyConn = Nothing


Response.Redirect("menuc.asp")
%>

Cristian Banu
Soft 4 web
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.