none
Timer to check database? RRS feed

  • Question

  • I have a program that checks a database for pending orders.  If there are no pending orders when the program starts, the program won't do anything because it needs the pending orders to process them.  I need to be able to  re-check the database at a specific time interval (10 minutes) to see if any orders have become "pending".  If the program finds pending orders, it needs to execute methods using the returned pending orders.  Would the best way to accomplish this be a timer?  If so, how would it be set up?  If not a timer, what else would accomplish this?

    Thank you in advance for your help.
    Thursday, October 25, 2007 5:34 PM

Answers


  • the implementation depends on your version of sql server, as I remember, sql server 2005 supports using C# as language for extended store proc.

    general google search can return some stuff

    http://www.google.com/search?hl=en&rlz=1B3GGGL_enUS241US242&q=sql+server+extended+store+procedure+tutorial&btnG=Search

    I've seen dll implemented for  sql server 2000 to insert data coming to database table into MSMQ written in C++

    MSDN entry 'extended stored procedures' exists in my vs.net 2005 installation which has a lot related informatoin as well.

    another possibility is to let your program which inserts data into database 'branch' out the data for your monitor process to consume.

    good luck.



    Thursday, October 25, 2007 6:35 PM

All replies


  • IMHO, I think an extended store procedure would be a better choice. which gets executed when new order inserted into the database table. you can either process this in the databse directly or you can write the data to a message queue etc so that your program can get the data immediately.
    Thursday, October 25, 2007 6:05 PM
  • Thanks for your quick response.  You are correct, this would work a lot better.  Im not familiar with extended store procedures.  Would you be able to provide me with an example or point me to a source for more information?  Thanks again for you help. 

     

    Thursday, October 25, 2007 6:19 PM

  • the implementation depends on your version of sql server, as I remember, sql server 2005 supports using C# as language for extended store proc.

    general google search can return some stuff

    http://www.google.com/search?hl=en&rlz=1B3GGGL_enUS241US242&q=sql+server+extended+store+procedure+tutorial&btnG=Search

    I've seen dll implemented for  sql server 2000 to insert data coming to database table into MSMQ written in C++

    MSDN entry 'extended stored procedures' exists in my vs.net 2005 installation which has a lot related informatoin as well.

    another possibility is to let your program which inserts data into database 'branch' out the data for your monitor process to consume.

    good luck.



    Thursday, October 25, 2007 6:35 PM
  • I will check these resources and get this figured out.  Thanks again for pointing me in the right direction.

     

    Thursday, October 25, 2007 6:41 PM