PDA

View Full Version : Generating a database report to be Sent as an email


saihati
04-09-2010, 05:09 AM
Hi everybody,

I have a website that receives online customer orders. Once an order is submitted, it will be entered to the database as a "new" order and sends an email to the order taker in the website. The next step is handled manually.

The website owner wants to create a reminder report for all requests that have not been handled for more than 48 hours which will be triggered daily by the Task Schedule Manager of DASP.

I am using ASP.net GridViews, DetailsViews, and DataLists in this website application. Now, I want to create a loop to generate a HTML table to be sent as the email reminder for those orders. So, in the .aspx file I have the database output table and on the other file .aspx.vb I have the email object which will include the output table to the order taker.

In the I am facing difficulty to which method I should use to include the output to my message object (MessageBox) in the .aspx.vb.

Please, advise me if there is a way to do so as I don't want to use a classical ASP file to do so. :D

bruce
04-09-2010, 05:33 PM
have you considered reporting service? you can schedule report to be sent on a scheduled basis.

saihati
04-10-2010, 10:40 AM
Bruce,
Thanks for your prompt reply.

Honestly speaking, I haven't. Though, after some snooping around, I think such a service is supporting MS SQL database not MS Access databases which I use.

Anyway, do you have a way to pass the output of a GridView to a .aspx.vb file so that I can include it in the email message body?

Taking a look at this might give you an idea of what I need to see in system scheduled reminder email message: Here! (http://alabbasgrp.com/carton/main56.aspx)

Appreciate your hints. ;)

CrystalCMS
04-11-2010, 05:37 AM
I'd say you're correct to think about using the DASP task scheduler for this:

Create a new aspx page that will be called from the scheduler.
Put some code in the page code-behind to perform a SQL query on your MSAccess db using the RequestState and SubmissionDateTime columns. This will return the rows to be attached to your reminder email.
Write code to create and send an email using the data you got in step 2.
Finally configure the scheduler to call this new aspx page once per day.

When the page is called regularly and automatically each day by the scheduler, it will compile a new report and email it to the designated recipient.

saihati
04-11-2010, 11:00 AM
Many thanks CrystalMS,

The key word was the use of "HTMLTextWriter" which by it, you will be able to render the ready made GridView to HTML code and prepare it to be sent by an email to the order takers.

Yours,

Saihati