locked
Alternative to infinite loop RRS feed

  • Question

  • Hi all,

    we are running one third party application which uses C#,SQL SERVER.we have created one other application which prints the pass.basically it does continuous checking of new entry from third party application in one of the table on remote database.if entry present then print pass.Accessing network database in such way is not good way and also sometimes application hang.

    Instead of continuous loop,i am searching for some other way like As the new entry comes, it trigger my application for print or any other good way to implement.

    Thanks


    RAHUL


    Tuesday, August 20, 2013 5:32 AM

Answers

All replies

  • Rahul , please tell what type of application your are using to communicate . like is it a WCF or something else...
    Tuesday, August 20, 2013 5:56 AM
  • both applications are desktop application in C#.

    RAHUL

    Tuesday, August 20, 2013 6:01 AM
  • you can use observer design pattern (chk this link to understand this pattern http://msdn.microsoft.com/en-us/library/ee850490.aspx)  by which you can send push notification to inform ...... or if your desktop application are on WPF then use Inotification . 


    Tuesday, August 20, 2013 6:40 AM
  • you can use observer design pattern  by which you can send push notification to inform ...... or if your desktop application are on WPF then use Inotification . 
    Tuesday, August 20, 2013 6:41 AM
  • For a database table you can define a “trigger” – a special procedure that is executed when an event like “data inserted” occurs. The trigger can be also done in C#. See some details: http://msdn.microsoft.com/en-us/library/938d9dz2(v=vs.100).aspx. So you can create C# code that automatically executes after changes in database.

    Tuesday, August 20, 2013 6:49 AM
  • have a UDP listener in the print application and have the trigger on insert send a UPD ping. would be one easy and straight forward way to do it.

    Tuesday, August 20, 2013 6:50 AM
  • Hi Rahul,

    one possibility is to setup a query notification, see

    Detecting Changes with SqlDependency

    and Query Notification using SqlDependency and SqlCacheDependency

    Regards, Elmar

    • Marked as answer by RAHUL J PATEL Tuesday, August 20, 2013 8:52 AM
    Tuesday, August 20, 2013 7:55 AM