|
 |
asp_databases thread: HELP!!!!!!! PLEASE
Message #1 by "Dale Wright" <dwright@c...> on Thu, 3 Oct 2002 17:26:44
|
|
Please please can someone help me with this!
"I solved the last issue, this is a new one""""
I have a page that checks a database to see if a users problem call has
been closed.... if the call is closed, an email is sent to that user via
CDONTS.....This is only sent once the condition is true (ie that the date
in the field matches TODAYS date)
Now there is no problems in doing this, but the MAIN problem is as follows:
The email is sent to all those who match the criteria... Record/User 1
receives an email with their details....
Record/User 2 also receives an email with their details but also with
Record/USer 1's details.....
Record/User 3 also receives an email with their details but also with
Record/USer 1's & 2' details..... Got the drift!!!!!!!!!
Why the help this is doing this i dont know, but i cannot figure this
out... i know that it will be something simple, but i just cant figure out
what!!!!1
What should happen is that user 1 receives his confirmation/information
that their call is closed.
User 2 receives his confirmation/information that their call is closed.
User 3 receives his confirmation/information that their call is closed.
Sounds Simple dosent it????Well it isnt.ahhhhhhhhhhh i am about to pull my
hair out.....
if you could help, please do so.... here is my code......
Dim oConn
Dim oRS
Set oConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
SQLtxt = "SELECT Calls.Callid, Calls.ContactID,
Calls.Forename, CallsHistory.Action, Calls.Surname, Calls.Email,
CallsHistory.Notes, Calls.DateClosed "
SQLtxt = SQLtxt & " FROM Calls INNER JOIN CallsHistory ON
Calls.Callid = CallsHistory.FKey "
SQLtxt = SQLtxt & " WHERE (((CallsHistory.Action)=4))
ORDER BY Calls.CallID;"
oRS.Open SQLtxt,"DSN=sunrise_db"
While Not oRS.EOF
If oRS("DateClosed") = Date() Then
Set objMail = Server.CreateObject("CDONTS.NewMail")
HTML = HTML & "<HTML>"
HTML = HTML & "<HEAD>"
HTML = HTML & "<BODY bgcolor=white>Does
this work?"
HTML = HTML & "" & ors("Forename") & ""
HTML = HTML & "</BODY>"
HTML = HTML & "</HTML>"
objMail.From = "400@m..."
objMail.Subject = "Does it work"
objMail.BodyFormat = 0
objMail.MailFormat = 0
objMail.To = oRS("Email")
objMail.Body = HTML
objMail.Send
Set objMail = Nothing
Response.Write "" & oRS("Forename") & " " & oRS
("Surname") & ""
End if
oRS.Movenext
Wend
Set ors = nothing
Set oconn = nothing
%>
Thankyou very much
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 4 Oct 2002 13:06:41 +1000
|
|
...stop and think a little bit about how this bit of code is working:
: HTML = HTML & "<HTML>"
: HTML = HTML & "<HEAD>"
: HTML = HTML & "<BODY bgcolor=white>Does
: this work?"
: HTML = HTML & "" & ors("Forename") & ""
: HTML = HTML & "</BODY>"
: HTML = HTML & "</HTML>"
Notice how you are always appending something to the variable called HTML?
<%
HTML = HTML & "more stuff"
%>
What you really need to do is change the first line so that "<html>" is
*not* appended to any existing content in the variable called HTML.
<%
strMsgBody = "<html>"
strMsgBody = strMsgBody & "<head>"
strMsgBody = strMsgBody & "<body bgcolor=""#ffffff"">"
'
'
%>
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Dale Wright" <dwright@c...>
Subject: [asp_databases] HELP!!!!!!! PLEASE
: Please please can someone help me with this!
:
: "I solved the last issue, this is a new one""""
:
: I have a page that checks a database to see if a users problem call has
: been closed.... if the call is closed, an email is sent to that user via
: CDONTS.....This is only sent once the condition is true (ie that the date
: in the field matches TODAYS date)
:
: Now there is no problems in doing this, but the MAIN problem is as
follows:
:
: The email is sent to all those who match the criteria... Record/User 1
: receives an email with their details....
:
: Record/User 2 also receives an email with their details but also with
: Record/USer 1's details.....
:
: Record/User 3 also receives an email with their details but also with
: Record/USer 1's & 2' details..... Got the drift!!!!!!!!!
:
: Why the help this is doing this i dont know, but i cannot figure this
: out... i know that it will be something simple, but i just cant figure out
: what!!!!1
:
: What should happen is that user 1 receives his confirmation/information
: that their call is closed.
:
: User 2 receives his confirmation/information that their call is closed.
:
: User 3 receives his confirmation/information that their call is closed.
:
: Sounds Simple dosent it????Well it isnt.ahhhhhhhhhhh i am about to pull my
: hair out.....
:
: if you could help, please do so.... here is my code......
:
:
: Dim oConn
: Dim oRS
:
: Set oConn = Server.CreateObject("ADODB.Connection")
: Set oRS = Server.CreateObject("ADODB.Recordset")
:
: SQLtxt = "SELECT Calls.Callid, Calls.ContactID,
: Calls.Forename, CallsHistory.Action, Calls.Surname, Calls.Email,
: CallsHistory.Notes, Calls.DateClosed "
: SQLtxt = SQLtxt & " FROM Calls INNER JOIN CallsHistory ON
: Calls.Callid = CallsHistory.FKey "
: SQLtxt = SQLtxt & " WHERE (((CallsHistory.Action)=4))
: ORDER BY Calls.CallID;"
:
: oRS.Open SQLtxt,"DSN=sunrise_db"
:
: While Not oRS.EOF
:
: If oRS("DateClosed") = Date() Then
:
: Set objMail = Server.CreateObject("CDONTS.NewMail")
: HTML = HTML & "<HTML>"
: HTML = HTML & "<HEAD>"
: HTML = HTML & "<BODY bgcolor=white>Does
: this work?"
: HTML = HTML & "" & ors("Forename") & ""
: HTML = HTML & "</BODY>"
: HTML = HTML & "</HTML>"
: objMail.From = "400@m..."
: objMail.Subject = "Does it work"
:
: objMail.BodyFormat = 0
: objMail.MailFormat = 0
:
: objMail.To = oRS("Email")
: objMail.Body = HTML
: objMail.Send
:
: Set objMail = Nothing
:
: Response.Write "" & oRS("Forename") & " " & oRS
: ("Surname") & ""
:
: End if
:
: oRS.Movenext
:
: Wend
:
: Set ors = nothing
: Set oconn = nothing
:
: %>
:
:
: Thankyou very much
Message #3 by "Dale Wright" <dwright@c...> on Fri, 4 Oct 2002 10:00:21
|
|
KEN,
THANKYOU,THANKYOU,THANKYOU,THANKYOU,THANKYOU,THANKYOU,THANKYOU,THANKYOU,THA
NKYOU,THANKYOU,THANKYOU,THANKYOU,..........VERY MUCH....
I knew that it was something stupid, i have been pulling my hair out for
the last 2 days, and you have solved it for....(Its too early to be going
bold @ 20, you have just saved some of my hair)
Once again
Thanks very much!
Dale
|
|
 |