Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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
 
Old July 18th, 2012, 03:48 AM
Authorized User
 
Join Date: Dec 2009
Posts: 85
Thanks: 16
Thanked 0 Times in 0 Posts
Default auto send of email

Not sure if this is the right category but here goes!

I'm wanting to send out an email from sql immediately after a date has passed.

In my sql server table I have a datetime field called enddate - immediately after that date I need to auto send an email out from sql


Is there a way to do this? I'm using asp as my scripting language. Perhaps I need to be able to have some kind of script that checks the datetime every 15 minutes or something?

If someone could point me in the right direction that would be great.

thanks

Adam
 
Old July 19th, 2012, 03:19 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Adam,

A common way to do this is to schedule an application on the server that does this. Could be a command line tool written in .NET that accesses the database and sends out the e-mail. It could also be a simple vb script or something similar that requests a URL of a web page or web service that executes the code for you. Finally, SQL Server has powerful scheduling and package execution options as well (with SSIS, SQL Server Integration Services) but that might be a bit overkill.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old July 19th, 2012, 07:14 AM
Authorized User
 
Join Date: Dec 2009
Posts: 85
Thanks: 16
Thanked 0 Times in 0 Posts
Default auto email send

thanks as always for your response Imar.

I'm using sql express actually so not sure it handles tasks.

How would I go about writing a vb script could I use to keep checking the date on the server to check the date field in my database table?

thanks


Adam
 
Old July 19th, 2012, 07:34 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
could I use to keep checking the date on the server to check the date field in my database table?
Not sure what that means.

I mentioned the VB script as a means to call a URL (a web page, a service maybe) that would execute the code at the server. You could also do what you need to do directly in the VB Script file; it enables you to do stuff similar to classic ASP, such as access a database using ADO.
Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Last edited by Imar; July 19th, 2012 at 07:37 AM.. Reason: Removed the link as it pointed to an ASP tutorial
 
Old July 19th, 2012, 07:49 AM
Authorized User
 
Join Date: Dec 2009
Posts: 85
Thanks: 16
Thanked 0 Times in 0 Posts
Default auto email send

Hi Imar

thanks for that - sorry, what I mean't was - how would one go about writing a piece of asp scripting that would continuously post to the server to check the database to see if that date had been reached?

thanks


Adam
 
Old July 19th, 2012, 08:32 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You wouldn't necessarily post to the server, nor would you do this continuously. Here's what I would do:

1. If you control the server, write a vb script file that accesses the database and does whatever you need it to do. The code you need is similar to the classic ASP code you're already using. Then use Windows Scheduler on the server to execute this script file every X minutes.

2. If you don't control the server, write an ASP file that accesses the database and does whatever you need it to do. Save this file inside your web site. Then, on another server that you do control, write a VB script that requests this page. Then use Windows Scheduler on the server to execute this VB script file every X minutes. The script then in turn calls your classic ASP page which does the database work.

There are many other solutions available as well, including Scheduler controls for ASP.NET. However, I find option 1 the easiest to do. Rather than a vb script file you can of course also use a .NET Command Line tool or any other type of app. I just mentioned vb script as it enables you use your existing classic ASP skills.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
adamhw (July 19th, 2012)





Similar Threads
Thread Thread Starter Forum Replies Last Post
auto send of email adamhw SQL Server 2008 0 July 18th, 2012 03:46 AM
I need to send auto Email by access VBA Anud Access VBA 1 December 10th, 2009 09:33 AM
Store procedure,auto send email after X days.(+asp kumiko SQL Server 2005 2 February 29th, 2008 01:15 PM
auto tracker function &send personalised email miracles Excel VBA 1 April 27th, 2007 04:43 AM
Auto send email from command button underscore10304 Access VBA 3 September 26th, 2006 06:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.