Feeds:
Posts
Comments

Posts Tagged ‘Databases’

Muhammad Shoaib Anjum, Ultimus Pakistan

 

SQLServer

Ever wondered if you can write a neat piece of code that can perform SQL Server backups for you? Or restore a database from a backup file for you. If this makes you think that it may take you guts to do that, don’t worry.

I thought the same before I came across SMO (SQL Management Objects). SMO is a collection of objects provided by Microsoft for developers to interact with SQL Server, or you may call it SQL Server API in simpler words. Using SMO, you can do virtually everything with a SQL Server instance from within your application. In this article we’ll briefly go through the steps needed to be followed in order to perform a backup and to restore a backup.

Among others, SMO provides a Backup object. All you need to do is to set some properties and call some methods on this object, and BOOOMMMM! The backup is there.

(more…)

Read Full Post »