开发者

Call SSIS from c# web app and display progress

开发者 https://www.devze.com 2023-03-15 14:25 出处:网络
I have an SSIS package that loads data from an excel file to a database. The user goes to the intranet page (normal c# .net 4.0 web app), selects the file they want to upload, and then clicks a butto

I have an SSIS package that loads data from an excel file to a database.

The user goes to the intranet page (normal c# .net 4.0 web app), selects the file they want to upload, and then clicks a button. The button copies the file to the server and then starts a SQL job that calls the package. This works fine and dandy but the user has no idea when the job finishes.

What's the best way to show the user that the package has completed (or failed)?

I have seen links like - http://www.programminghelp.com/database/sqlserver/sql-server-integration-services-calling-ssis-package-in-c/ but this is for C# Console Project. What's the best way to do this with a web applic开发者_如何学编程ation?


There are a number of ways to do this but if you're looking for an easy way then you could use the SmtpClient class in the System.Net.Mail namespace to send an email to the user when the job finishes. (There's a nice, simple code snippet on that page that you could reuse readily.) Of course you would have to have a sending account set up (no-reply@myAutomatedJobThing.com for example) and know the user's email address.

Whether this is the best solution in your scenario is debatable but I've seen it employed (and employed it myself) for a number of systems where such a process takes an appreciable amount of time, say a couple of minutes or longer. If your import just takes a few seconds then the email solution might be overkill.

A simpler, AJAX-style solution might involve browsing to a page (after initiation) that polls the job via a timer and displays the progress in-page. Even an auto-reload might work. The piece of metadata you would need for this is a unique identifier for the job that the user executed.

0

精彩评论

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