473,699 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2005: using SMO

Hello,
I am learning SQL Server 2005. I would like to write a procedure
making database backup using SMO. According to my book I should write
such code:

using Microsoft.SqlSe rver.Management .SMO;
public static void MakeBackup()
{
Server server = new Server("localho st");
Backup backup = new Backup();
backup.Action = BackupActionTyp e.Database;
backup.BackupSe tName = "Backup copy";
backup.BackupSe tDescription = "Backup copy";
backup.Database = "DemoSQLServer" ;
backup.Devices. AddDevice("C:\\ DemoSQLServer.b ak",
DeviceType.File );
backup.SqlBacku p(server);
}

The code cannot be compiled because of error:
The type or namespace name 'Management' does not exist in the
namespace 'Microsoft.SqlS erver'.
Please help to correct the problem - I cannot find proper name of SMO
namespace. Is the code OK?
Thank you very much
/RAM/
Jul 11 '06 #1
2 4345
I tried adding references to Microsoft.SqlSe rver.Connection Info and
Microsoft.SqlSe rver.Smo - and I could build assembly. But then I
cannot create assembly in SQL Server:

"An exception occured while executing a Transact statement or batch
(Microsoft.SqlS erver.Express.C onnectionInfo).
Assembly 'microsoft.sqls erver.smo, version=9.0.242 .0, culture=neutral ,
publictoken=898 45dcd8080cc91.' was not found in the SQL catalog.
(Microsoft SQL Server, Error: 6503)"

Could you help me to solve it...
Jul 12 '06 #2
R.A.M. (r_********@poc zta.onet.pl) writes:
I tried adding references to Microsoft.SqlSe rver.Connection Info and
Microsoft.SqlSe rver.Smo - and I could build assembly. But then I
cannot create assembly in SQL Server:

"An exception occured while executing a Transact statement or batch
(Microsoft.SqlS erver.Express.C onnectionInfo).
Assembly 'microsoft.sqls erver.smo, version=9.0.242 .0, culture=neutral ,
publictoken=898 45dcd8080cc91.' was not found in the SQL catalog.
(Microsoft SQL Server, Error: 6503)"

Could you help me to solve it...
There is a smaller set of .Net Fx assemblies that are loaded by default
in SQL Server. Apparently Microsoft.SqlSe rver.Smo is not one of them.
You could create an assembly in your database for the DLL with CREATE
ASSEMBLY, but I suspect that there is a reason why this DLL is not
loaded. I don't think the intention is that SMO is to be called from
within SQL Server. (But I have stayed away from SMO, so I don't really
know for sure.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8908
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.