 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 9th, 2004, 01:52 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It said
Exception occurred
but the email's were still sent to my test address so I am not sure why that is
-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
|
|

June 9th, 2004, 04:38 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Nothing else? No error number?
What happens when you write out the SQL statement? I assume your code looks different from what you posted last time??
update "ORNewsletterTest set Mailsent=1 where NewsletterId In (" & NewsletterId & ")"
This won't work, as this isn't valid string or sql statement. Try fixing it, like this for example:
Dim SQL
SQL = "UPDATE ORNewsletterTest SET Mailsent=1 WHERE NewsletterId IN (" & NewsletterId & ")"
Response.Write(SQL)
Response.End
If you put that code in, what do you get?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

June 10th, 2004, 07:12 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Here is my new code with your new update statment
It stops on this line
error '80020009'
Exception occurred.
NewsletterId = NewsletterId & RS("NewsletterId")
-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
|
|

June 10th, 2004, 07:18 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
What I meant was for you to post the outcome of your SQL statement. I think it will end up like this:
WHERE Bla bla IN (1, 2, 3, )
As you can see, it ends with an additional comma, which is not allowed. You'll need to strip it off before you send it to the database.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

June 10th, 2004, 07:21 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Oh, and another thing: You should move the code that adds the ID to inside the loop:
RS.MoveNext
next
.....
'And store the mailId or KeyFieldValue in an array
If len(NewsletterId) > 0 Then
NewsletterId = NewsletterId & ", "
end if
NewsletterId = NewsletterId & RS("NewsletterId")
As you can see, you loop through your entire recordset. After the last record, you try to access the recordset, which is not going to work as it is now EOF.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

June 10th, 2004, 07:35 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I can't show you the outcome of the sql statment because it never makes it there I moved this up into the loop but it still generates an error
I don't think the syntax is right :-(
If len(NewsletterId) > 0 Then
NewsletterId = NewsletterId & ", "
end if
NewsletterId = NewsletterId & RS("NewsletterId")
-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
|
|

June 10th, 2004, 07:45 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Did you move it to before the MoveNext call?
|
|

June 10th, 2004, 07:55 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
well I did now ;)
Okay this time I got this
Update ORNewsletterTest set Mailsent=1 where NewsletterId in (, 1, 2, 3, 4, 5)
-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
|
|

June 10th, 2004, 08:59 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right, that's what I thought. You need a way to ignore the first comma. There are at least 2 ways to do that.
1. Strip if of, right before you send it.
NewsletterId = Right(NewsletterId, (Len(NewsletterId) -2))
2. Alternatovely, don't add it in the first place. Inside your main loop, add a counter that keeps track of the number of records. If it's zero (the first record), don't add the comma:
If Len(NewsletterId) > 0 And LoopCounter > 0 Then
NewsletterId = NewsletterId & ", "
End If
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

June 10th, 2004, 09:17 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 166
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I added the loop like this
If Len("NewsletterId") > 0 And LoopCounter > 0 Then
NewsletterId = NewsletterId & ", "
End If
NewsletterId = NewsletterId & RS("NewsletterId")
But now it returns this vaule
Update ORNewsletterTest set Mailsent=1 where NewsletterId in (12345)
[EDIT]I used this instead
NewsletterId = Right(NewsletterId, (Len(NewsletterId) -2))
and it works great [EDIT]
-----------------------------------------------------------
"Don't follow someone who's not going anywhere" John Mason
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Newsletter Mechanism |
vivek_inos |
ASP.NET 1.0 and 1.1 Professional |
1 |
September 22nd, 2007 07:38 AM |
| Where is the newsletter option |
luisjeronimo |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 |
3 |
July 20th, 2007 03:16 PM |
| newsletter |
vantoko |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 |
2 |
February 28th, 2007 03:28 AM |
| Newsletter |
sydneyausguy |
BOOK: Professional DotNetNuke ASP.NET Portals ISBN: 0-7645-9563-6 |
1 |
August 19th, 2005 05:23 PM |
| help with newsletter question |
AStuntz |
Beginning PHP |
1 |
May 13th, 2004 06:54 PM |
|
 |