thread pooling

Posted on 2012-09-22
Last Modified: 2012-10-02
i have a table. who have always new record on it
so i want to process all record when i process it i change the status of record field to begin processing and when i finish i update the status to done
i have read some topics and they talk about thread and time.. and pooling

the default value of status of task is "to process"
do a task ! like select top (100) from table where status = "to process"
than i update the status to begin process .
insert in other table
update status to done
i want to use transction begin and end and rollback if my job not committed it will be rollback  i don\t know about how to it on c# and mssql ..

than sleep to 30 second.. after fetch all top 100 row and do my job slelect update insert

than i repeat it always. i want to run it as windows services.

can any one check tthis code and tell me if it was i try to doo

  Private Sub PollProcess()
        ' Loops, until killed by OnStop.

        EventLog1.WriteEntry("PollingService service polling thread started.")
            ' Wait...

            System.Threading.Thread.Sleep(30000) ' 30000 = 30 seconds

    End Sub

    Private Sub PollingPass()
            ' Do Stuff Here...

            EventLog1.WriteEntry("PollingService service polling pass executed.")
        Catch ex As System.Exception
            EventLog1.WriteEntry("PollingService encountered an error '" & _
                ex.Message & "'", EventLogEntryType.Error)
            EventLog1.WriteEntry("PollingService service Stack Trace: " & _
                ex.StackTrace, EventLogEntryType.Error)
        End Try
    End Sub

            ' Do Stuff Here...
here i wil but my sql query????

and i want some one tell me if this app  do a a stuff when the stuff finish ... sleep 30 second and repeat the same jobbbbbbbbbbb???????????/

i need to do like this ?
Question by:afifosh
    LVL 25

    Expert Comment

    Use a system.threading.timer control and set it timespan to 30 seconds.

    When the timer method is called , first you disable your timer so it doesn't trigger again.

    Do you select, insert etc

    Finally you enable th timer, so that it waits for 30 seconds and triggers.
    LVL 12

    Accepted Solution

    Why don't you use SQL server JOBS .. They are quite efficient to do this kind of functionality.
    Check below link . you can write your logic with in SP and can call that SP through a job .

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now