Wednesday, January 2, 2008

PercentComplete Eventhandler…

Last week during my VB.NET Coding for my current project, I had to write a code for Database Backup( fortunately the database is my favorite SQL Server 2005 :) ) .

So simply I started using the SMO objects, and I succeeded with a little efforts as SQL SMO objects have a plenty of resources for this kind of jobs!

When I started working on showing the progress of the Backup, I want to add EventHandler code to my Backup Object and started searching internet. There are plenty of code samples available in the internet that are mainly focusing C# and mine is VB.NET. But of course, I got the foundation idea of how to show the percentage completed during the backup.

The EventHandler I have to add to my code is backup object’s PercentComplete.

So I did the following code with the help of the sqldbatips.com atricle id 40 authoured by Jasper Smith(wonderful article.).(http://www.sqldbatips.com/showarticle.asp?ID=40)

One of the best article for the beginners of SQL SMO objects in both C# and VB.NET programmers. It is working very fine.

But if your Database is a grownup one to more than 150G then this percentComplete may not give you the correct percentage values.

To work with the SMO Objects in Visual Studio Projects, don’t forget to add references to the following assemblies.

Microsoft.SqlServer.ConnectionInfo.dll

Microsoft.SqlServer.Smo.dll

Microsoft.SqlServer.SmoEnum.dll

On searching this on internet I came across one more useful post in falafel.com blogs.

http://www.falafel.com/community/blogs/vsnet/archive/2007/07/09/get-meta-data-do-backups-with-sql-management-objects-smo.aspx

This is also having good program examples for C# programmers.

1 comment:

Kumar S said...

Sorry posted comment into other post.

Good article you have pointed. however the second url does not work.

Can you post some articles for the beginner of sql server 2005/2008.


PS: do you work with this much computers at a time. gr8. ;) ?!?!