# Re: 如何在 VB 程式中执行 SQL Server DataBase 之备份...

Posted by jimmy on March 26, 1999 at 09:57:41:

In Reply to: Re: 如何在 VB 程式中执行 SQL Server DataBase 之备份... posted by SENDY on March 24, 1999 at 10:41:52:

: 我也在研究这个问题,,,,刚刚查了一下书,应该可以用STORE PROCEDURE做吧

:
: : 请问如何在 VB 程式中以指令方式, 对 SQL Server DataBase 做备份/回存作业
: : 在 SQL Server 中以视窗介面执行备份/回存作业, 我知道怎么做, 但在要在 VB
: : 中写程式, 我就不知道了, 请帮帮忙, 提供范例, 谢谢!

: : 开发环境: VB 5.0 Enterprise Version, WINnt Workstation, SQL Server
dim OServer As New sqlole.SQLServer
Dim MyBackup As New sqlole.backup ' create my backup Object
OServer.Connect ServerName:="nt_name", Login:="sa", Password:=""
Set CN = New ADODB.Connection
With CN
.Provider = "SQLOLEDB"
.ConnectionString = "User ID=sa;" & _
"Data Source=nt_name;" & _
"Initial Catalog=pubs"
.Open
End With
OServer.Databases("pubs").Dump MyBackup ' DUMP it!

Follow Ups: