By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,905 Members | 879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,905 IT Pros & Developers. It's quick & easy.

Calling SQL Server backup maintenance plan from VB program ?

P: n/a
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.
Jul 3 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"fniles" <fn****@pfmail.comwrote in
news:Oy**************@TK2MSFTNGP03.phx.gbl:
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
Jul 3 '07 #2

P: n/a
or you can also connect using any API and just execute sp_start_job.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Spam Catcher" <sp**********@rogers.comwrote in message
news:Xn**********************************@127.0.0. 1...
"fniles" <fn****@pfmail.comwrote in
news:Oy**************@TK2MSFTNGP03.phx.gbl:
>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

Jul 3 '07 #3

P: n/a
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.

"Spam Catcher" <sp**********@rogers.comwrote in message
news:Xn**********************************@127.0.0. 1...
"fniles" <fn****@pfmail.comwrote in
news:Oy**************@TK2MSFTNGP03.phx.gbl:
>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

Jul 5 '07 #4

P: n/a
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

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"fniles" <fn****@pfmail.comwrote in message news:uI**************@TK2MSFTNGP05.phx.gbl...
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.

"Spam Catcher" <sp**********@rogers.comwrote in message
news:Xn**********************************@127.0.0. 1...
>"fniles" <fn****@pfmail.comwrote in
news:Oy**************@TK2MSFTNGP03.phx.gbl:
>>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

Jul 6 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.