开发者

Run SQL queries at predefined time

I am new to C#.

I have to write an application that would automatically run multiple predefined sql queries on multiple predefined databases at the same time every day. The application then has to take this information from the queries and compile it into 1 form/report, and then send this form/report to a predefined e-mail address. All this must happen automatically every day at the same time.

I do know how to connect to a database and run queries on it in a C# application; I also know how to e-mail a form/ report from within a C# application.

My questions a开发者_运维问答re:

  1. How would it be possible to have this application run automatically at a predefined time every day?
  2. How would I compile all this information into 1 form/report (I am using multiple databases and multiple queries)

I take it that this might be a console application?

I can’t find any references to this anywhere. Any help would really be much appreciated.

Thanks in advance!


Don't try to build this logic yourself. I've done it a couple of times and it's just not worth it.

  1. You should use the built in Windows Scheduler for this. You can set up when your application should run, how often it should reccur and much more. A console application or Windows service will do just fine.

  2. This is hard to answer without knowing how your application is structured.Can't you just run your queries and combine the results into a report?


Windows scheduler or a unix cron job to run your app at a certain time is the usual way.


You can shedule a task for windows http://support.microsoft.com/kb/308569 And you can megrge infogmation from several DataTables

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜