This is one of the subscription scripts wrote, and I can’t figure out why it won’t work. Can anyone help? Note: This is an include file, and doesn’t run by itself.
[CODE]<%
If blnEmail = True AND strMode <> “edit” Then
Dim rsSubcriptions
Dim objCDOMail
Set rsSubscriptions = Server.CreateObject(“ADODB.Recordset”)
strSQL = “SELECT * FROM subscribers;”
rsSubscriptions.CursorType = 2
rsSubscriptions.LockType = 3
rsSubscriptions.Open strSQL, strCon
Do UNTIL rsSubscriptions.EOF
strEmailSubject = strLangSubjectEmailNewBlog
strEmailBody = strLangEmailHi & rsSubsciptions.Fields(“subscriber_name”)
strEmailBody = strEmailBody & “
[QUOTE=Bliss]
This is one of the subscription scripts wrote, and I can’t figure out why it won’t work. Can anyone help?
[/QUOTE]
For the sake of debugging, I would insert some code just before you loop through the recordset that does a response.write of the recordset’s rowcount. This would answer 2 questions: 1) is this code actually executing; and, 2) do you have any rows to process.
[QUOTE=riley]
For the sake of debugging, I would insert some code just before you loop through the recordset that does a response.write of the recordset’s rowcount.
[/QUOTE]
I’ve been doing .Net for over a year now, so my ASP3/ADO is rusty. So let me clarify my previous post, which made a vague reference to the recordset’s rowcount. ADO does not have a Rows collection and therefore, there is no rows.count propery like there is in .Net. For ASP3/ADO, the task can be accomplished with the following code:
rsSubscriptions.Open strSQL, strCon
Response.Write(“Rows retrieved=” & rsSubscriptions.RecordCount)
Do UNTIL rsSubscriptions.EOF
It’s amazing how quickly we forget. Too much information to absorb, or sinility? Probably a little of both…
riley
[QUOTE=WineIsGood]
When all else fails, then your first IF statment must be failing:
If blnEmail = True AND strMode <> “edit” Then
-Dave
[/QUOTE]
The trick here is to determine whether or not the code is executing as expected or there is a problem with the Send. I would add a counter after the send and show the results, as follows:
. . .
objCDOMail.Send
iCount = iCount + 1
rsSubscriptions.Movenext
Loop
Response.Write("Emails sent = " & iCount)
. . .
If the count is 0, the code is not doing what is expected. If the count is > 0, there is a problem with the use of the CDONTS object.