Using SQLDMO in .net (VB.net)

Using SQLDMO within .net isn't the easiest thing to find information about, so here goes with some documentation.

The first thing that you need to do is add a reference to the SQLDMO library. With .net, you do this by: (when within a project)

1 - Choose "Project" from the menubar and then "Add Reference"
2 - In the dialog that appears, choose the "COM" tab
3 - Choose (double click) the entry named "Microsoft SQLDMO Object Library", it will then appear in the listbox at the bottom of the dialog. ("Selected Components")
4 - Click OK

Note: If the SQLDMO entry is not present, then you likely don't have SQLDMO installed on your machine, or if you do its COM registration is in some way corrupt. Try re-installing.

In the "References" node of Solution Explorer, there will now be a new entry called "Interop.SQLDMO". You're all set now to start using SQLDMO in your code. It's worth noting that SQLDMO seems to have problems if you put an "Imports SQLDMO" directive in your code, so don't do it.

About Rob

I've been interested in computing since the day my Dad purchased his first business PC (an Amstrad PC 1640 for anyone interested) which introduced me to MS-DOS batch programming and BASIC.

My skillset has matured somewhat since then, which you'll probably see from the posts here. You can read a bit more about me on the about page of the site, or check out some of the other posts on my areas of interest.

No Comments

Add a Comment