Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 rowsets in blocks via a query
 New Topic  Topic Locked
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

Etymon
Advanced Member

United States
2395 Posts

Posted - 12 June 2007 :  14:55:23  Show Profile  Visit Etymon's Homepage
Thanks!
Go to Top of Page

Etymon
Advanced Member

United States
2395 Posts

Posted - 12 June 2007 :  15:08:23  Show Profile  Visit Etymon's Homepage
Well, in light of the e-mail that I sent to you where do you think I should head now?
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 12 June 2007 :  15:22:48  Show Profile  Send ruirib a Yahoo! Message
You could probably add a newsletter_sent field to the members table and set it to 0. Whenever a new newsletter is to be sent, get the fist 100 records, send the email, update the newsletter_sent for those members to the previous to 1. Then get the next 100 for which the field is not 1, send the emails, update the field, and so on, until you have no more members to send. You can then set the field back to 0, just to be ready for the next newsletter.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Etymon
Advanced Member

United States
2395 Posts

Posted - 12 June 2007 :  15:35:01  Show Profile  Visit Etymon's Homepage
I am pretty sure I understand. So the initial query (for selecting the second group) would go something like this for each member who wants the newsletter:

SELECT * FROM (
SELECT TOP 100 MEMBER_ID
FROM (SELECT TOP 200 MEMBER_ID
FROM FORUM_MEMBERS AS NEXT_200_MEMBERS
WHERE M_NEWSLETTER_SENT = 0
ORDER BY MEMBER_ID) AS FORUM_MEMBERS
ORDER BY MEMBER_ID DESC
) As T2
Order by MEMBER_ID ASC

And then after the script was finished with all of the batches of 100, it could do an update query and set the field back to 0 for all members who wanted the newsletter, right?

Ok, I need to automate this, while I have your keyboard (with fingers attached ), can I ask you how to automate it between batches ... say at 120 seconds?

Thanks Rui as always!


Edited by - Etymon on 12 June 2007 15:46:25
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 12 June 2007 :  15:54:31  Show Profile  Send ruirib a Yahoo! Message
No... if you use M_NEWSLETTER_SENT, you just need a single SELECT TOP 100 .... WHERE M_NEWSLETTER_SENT = 0 query. No need for anything else.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Etymon
Advanced Member

United States
2395 Posts

Posted - 12 June 2007 :  16:01:25  Show Profile  Visit Etymon's Homepage
LOL! Well, I guess I am not understanding then.

I'm eventually going to be selecting 4,000 members spaced at 120 seconds apart.

Wouldn't I do this:

SELECT TOP 100 MEMBER_ID
FROM FORUM_MEMBERS AS FIRST_100_MEMBERS
WHERE M_NEWSLETTER_SENT = 0
ORDER BY MEMBER_ID

Then send the mail out ...

... then do an update setting that group to a 1. After that, start with the second group, do the same, and continue until finished, and finally upon completion of everything set M_NEWSLETTER_SENT back to 0 for everyone?

Edited by - Etymon on 12 June 2007 16:04:30
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 12 June 2007 :  16:31:48  Show Profile  Send ruirib a Yahoo! Message
Yes, that's it.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

Etymon
Advanced Member

United States
2395 Posts

Posted - 12 June 2007 :  16:34:39  Show Profile  Visit Etymon's Homepage
Whew! Now I have to go on with the timing issue! LOL! Thanks so much, Rui!
Go to Top of Page

Etymon
Advanced Member

United States
2395 Posts

Posted - 15 June 2007 :  21:23:04  Show Profile  Visit Etymon's Homepage
OK, Rui.

I found a timer. I think. LOL!

Here's where I got it from: (http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar06/hey0330.mspx)

Here's the code for it though it only seems to work in Internet Explorer though I only need it to work in IE, so that's a good thing, huh?

<script language = "VBScript">

    Dim dtmStartTime

    Sub Test
        dtmStartTime = Now
        idTimer = window.setTimeout("PausedSection", 5000, "VBScript")
    End Sub

    Sub PausedSection
        Msgbox dtmStartTime & vbCrLf & Now
        window.clearTimeout(idTimer)
    End Sub

</script>

<body>
    <input id=runbutton  type="button" value="Run Button" onClick="Test">
</body>
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 17 June 2007 :  11:05:24  Show Profile  Send pdrg a Yahoo! Message
vbscript will only work in ie, you're right. Personally I'd be wary of using client-scripted timing loops to do stuff on the server, but I haven't got your full architecture - just beware that it may get you into a muddle thoguh
Go to Top of Page

Etymon
Advanced Member

United States
2395 Posts

Posted - 18 June 2007 :  16:18:27  Show Profile  Visit Etymon's Homepage
It's for an admin page, so IE is ok. I'll take your advice under council. Thanks!
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 19 June 2007 :  12:50:47  Show Profile  Send pdrg a Yahoo! Message
cool :)
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07