Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / July 2007

Tip: Looking for answers? Try searching our database.

Calling SQL Server backup maintenance plan from VB program ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fniles - 03 Jul 2007 16:48 GMT
I have created a backup maintenance plan in SQL Server 2005. Is there any
way to run/execute this SQL Server backup maintenance plan from VB.NET ?
Thank you.
Spam Catcher - 03 Jul 2007 18:06 GMT
> I have created a backup maintenance plan in SQL Server 2005. Is there
> any way to run/execute this SQL Server backup maintenance plan from
> VB.NET ? Thank you.

Take a look at the new SQL Management Objects (SMO). I think you can call a
backup plan from there.

http://msdn2.microsoft.com/en-
us/library/microsoft.sqlserver.management.smo.backup.aspx
Tibor Karaszi - 03 Jul 2007 20:23 GMT
or you can also connect using any API and just execute sp_start_job.

Signature

Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

>> I have created a backup maintenance plan in SQL Server 2005. Is there
>> any way to run/execute this SQL Server backup maintenance plan from
[quoted text clipped - 5 lines]
> http://msdn2.microsoft.com/en-
> us/library/microsoft.sqlserver.management.smo.backup.aspx
fniles - 05 Jul 2007 23:02 GMT
Thank you.
I tried the following but got an error
       Dim srv As Server
       srv = New Server("SQLServermachinename")
       Dim db As Database
       db = srv.Databases("myDbName")  --> error "Failed to connect to
server SQLServermachinename

Do I need to supply either the srv or db with the User ID and password ?
Is it correct that for New Server I want to set "SQLServermachinename" to it
?

Thank you.

>> I have created a backup maintenance plan in SQL Server 2005. Is there
>> any way to run/execute this SQL Server backup maintenance plan from
[quoted text clipped - 6 lines]
> http://msdn2.microsoft.com/en-
> us/library/microsoft.sqlserver.management.smo.backup.aspx
Tibor Karaszi - 06 Jul 2007 18:52 GMT
>        Dim srv As Server
>        srv = New Server("SQLServermachinename")

Above will use Windows authentication to connect to the specified server name. If you want to
connect to a named instance, well, you specify the server\instance name just as in any application.
If you want to use SQL authentication, you need to use a ServerConnection object. See:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/smo9/html/a17f72ef-e02b-47af-b58a-c4219b5bba81.htm

Signature

Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

> Thank you.
> I tried the following but got an error
[quoted text clipped - 17 lines]
>> http://msdn2.microsoft.com/en-
>> us/library/microsoft.sqlserver.management.smo.backup.aspx

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.