65.9K
CodeProject 正在变化。 阅读更多。
Home

网络 DTS 调度

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.73/5 (5投票s)

2004年3月22日

viewsIcon

43129

downloadIcon

578

网络 DTS 调度

引言

我们都熟悉 SQL Server 附带的 DTS 包。在这里,我们将描述如何从网络执行 DTS 包。这些包构建在任何 SQL Server / 客户端上。访问系统需要服务器 IP/名称、SQL Server 用户 ID 和密码。

接下来,点击查看按钮,我们会得到此服务器上列出的所有 DTS 包名称。选择其中一个并点击执行按钮,指定的 DTS 包将在服务器上被触发并执行。

因此,我们可以甚至从网络客户端执行 DTS 包,并定期执行 DTS。因此,所有需要定期更新和不时执行 DTS 包的部门商店,我们只需将其添加到计划任务中,并受益于避免手动操作。

希望这对读者有所帮助。

使用代码

DTS 对象及其实例的详细信息如下

// The DTS object instance is getting here, 
    Dim objDTSAppl      As DTS.Application
    Dim objPkgSQLServer As DTS.PackageSQLServer
    Dim colPkgInfo      As DTS.PackageInfos
    Dim objPkgInfo      As DTS.PackageInfo
    Dim strMsg          As String
    Dim iCount          As Integer
//

'Next call the GetPackageSQLServer() method, 
'and pass the sql-servername/ip, sqluserid, 
'and password. It will check the instance of the sql server, 
'and if found then check the user id/password 
'authentication on this server.
    
Set objDTSAppl = New DTS.Application
Set objPkgSQLServer = objDTSAppl.GetPackageSQLServer(
 Trim(txtServer.Text), Trim(txtUserID.Text), 
 Trim(txtPassword.Text), DTSSQLStgFlag_Default)
Set colPkgInfo = objPkgSQLServer.EnumPackageInfos("", True, "")
    
'After authentication it will read out all the
'DTs packages on this server, and add this in combo box.
 
  For Each objPkgInfo In colPkgInfo
        cmbDTSPackage.AddItem objPkgInfo.Name
        arrVersionID(iCount) = objPkgInfo.VersionID
        ReDim Preserve arrVersionID(UBound(arrVersionID) + 1)
        iCount = iCount + 1
  Next objPkgInfo

关注点

使用 DTS.ApplicationDTS.PackageSQLServer 和 DTS 类,我们甚至可以监控和使用 DTS 计划任务在离线应用程序或基于 Web 的表单中。

© . All rights reserved.