Percent complete in C# console app
I've
written a C# console application which, among other things, restores a
SQL Server database. It takes a while to restore and I'm wondering if
there is a way to display the percentage complete (like it shows when
you restore a database manually in the Message pane when STAT is on) in
my program console. I understand that if you have multiple tasks, rows,
etc. you can calculate the percent completed based off the number of
tasks completed divided by the total number of tasks. The problem is
that I only have one task, to restore the database.
MikePosted Jun 13, 2008, 9:39 AM
Jan MontanoPosted Jun 13, 2008, 3:14 AM
This is one of the accepted solutions: from that link
Then you can use the suggestion I made in my first post; i.e. start a timer just before you call the DB with the query. When it fires, increment a cyclic progress bar. That is one that fills from start to end, then goes back to empty and does it again. You can stop it when the select returns.
Jim
To conclude, it's really hard to put a timer since this is not a code in y our application. You could just have sort of a marker to tell the user that database restore is still in process. Given that you're using a console app, I would just write a period (.) in the console every 15 seconds or so, to indicate that the app is still processing.
Just my two cents.
MikePosted Jun 12, 2008, 3:43 PM
Anna HawksPosted Jun 12, 2008, 3:42 PM