Execute a stored procedure from a windows form asynchronously and then disconnect?

前端 未结 8 1318
青春惊慌失措
青春惊慌失措 2020-12-08 10:48

I am calling a stored procedure from my application that can take 30 minutes to execute.

I don\'t want to make my user leave the application open for that entire tim

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 11:23

    I suggest a re-architecture. Create a "work queue" table where you log requests to run the stored procedure. Then either have a Windows Service or a SQL Server job check that work queue from time to time (or be really ingenious and use a trigger) to kick off the stored procedure. Have the stored procedure update the progress from time to time in the work queue table, and your front-end can look at that an tell the user the progress, and then display the results when they're done.

提交回复
热议问题