我在SQL SERVER中利用数据转换功能生成了一个vb模块
但是在VB中添加此模块,在编译时却提示编译错误,说
开头的地方“goPackageOld As New DTS.Package”用户类型未定义,望各位高手不吝赐教!!
dts模块原代码如下:
'****************************************************************
'Microsoft SQL Server 2000
'Visual Basic file generated for DTS Package
'File Name: C:\Documents and Settings\Administrator\My Documents\liuliangcaiji.bas
'Package Name: liuliangcaiji
'Package Description: DTS 包描述
'Generated Date: 2003-3-27
'Generated Time: 8:51:10
'****************************************************************Option Explicit
Public goPackageOld As New DTS.Package
Public goPackage As DTS.Package2
Private Sub Main()
        Set goPackage = goPackageOld        goPackage.Name = "liuliangcaiji"
        goPackage.Description = "DTS 包描述"
        goPackage.WriteCompletionStatusToNTEventLog = False
        goPackage.FailOnError = False
        goPackage.PackagePriorityClass = 2
        goPackage.MaxConcurrentSteps = 4
        goPackage.LineageOptions = 0
        goPackage.UseTransaction = True
        goPackage.TransactionIsolationLevel = 4096
        goPackage.AutoCommitTransaction = True
        goPackage.RepositoryMetadataOptions = 0
        goPackage.UseOLEDBServiceComponents = True
        goPackage.LogToSQLServer = False
        goPackage.LogServerFlags = 0
        goPackage.FailPackageOnLogFailure = False
        goPackage.ExplicitGlobalVariables = False
        goPackage.PackageType = 0
        Dim oConnProperty As DTS.OleDBProperty'---------------------------------------------------------------------------
' create package connection information
'---------------------------------------------------------------------------Dim oConnection As DTS.Connection2'------------- a new connection defined below.
'For security purposes, the password is never scriptedSet oConnection = goPackage.Connections.New("DTSFlatFile")        oConnection.ConnectionProperties("Data Source") = "C:\Documents and Settings\Administrator\桌面\liuliang.txt"
        oConnection.ConnectionProperties("Mode") = 1
        oConnection.ConnectionProperties("Row Delimiter") = vbCrLf
        oConnection.ConnectionProperties("File Format") = 1
        oConnection.ConnectionProperties("Column Delimiter") = "        "
        oConnection.ConnectionProperties("File Type") = 1
        oConnection.ConnectionProperties("Skip Rows") = 0
        oConnection.ConnectionProperties("Text Qualifier") = """"
        oConnection.ConnectionProperties("First Row Column Name") = False
        
        oConnection.Name = "连接1"
        oConnection.ID = 1
        oConnection.Reusable = True
        oConnection.ConnectImmediate = False
        oConnection.DataSource = "C:\Documents and Settings\Administrator\桌面\liuliang.txt"
        oConnection.ConnectionTimeout = 60
        oConnection.UseTrustedConnection = False
        oConnection.UseDSL = False
        
        'If you have a password for this connection, please uncomment and add your password below.
        'oConnection.Password = "<put the password here>"goPackage.Connections.Add oConnection
Set oConnection = Nothing'------------- a new connection defined below.
'For security purposes, the password is never scriptedSet oConnection = goPackage.Connections.New("SQLOLEDB")        oConnection.ConnectionProperties("Integrated Security") = "SSPI"
        oConnection.ConnectionProperties("Persist Security Info") = True
        oConnection.ConnectionProperties("Initial Catalog") = "wangluo"
        oConnection.ConnectionProperties("Data Source") = "HIT-PHILYOUNG"
        oConnection.ConnectionProperties("Application Name") = "DTS 导入/导出向导"
        
        oConnection.Name = "连接2"
        oConnection.ID = 2
        oConnection.Reusable = True
        oConnection.ConnectImmediate = False
        oConnection.DataSource = "HIT-PHILYOUNG"
        oConnection.ConnectionTimeout = 60
        oConnection.Catalog = "wangluo"
        oConnection.UseTrustedConnection = True
        oConnection.UseDSL = False
        
        'If you have a password for this connection, please uncomment and add your password below.
        'oConnection.Password = "<put the password here>"goPackage.Connections.Add oConnection
Set oConnection = Nothing'---------------------------------------------------------------------------
' create package steps information
'---------------------------------------------------------------------------Dim oStep As DTS.Step2
Dim oPrecConstraint As DTS.PrecedenceConstraint'------------- a new step defined belowSet oStep = goPackage.Steps.New        oStep.Name = "创建表 [wangluo].[dbo].[liuliang] 步骤"
        oStep.Description = "创建表 [wangluo].[dbo].[liuliang] 步骤"
        oStep.ExecutionStatus = 1
        oStep.TaskName = "创建表 [wangluo].[dbo].[liuliang] 任务"
        oStep.CommitSuccess = False
        oStep.RollbackFailure = False
        oStep.ScriptLanguage = "VBScript"
        oStep.AddGlobalVariables = True
        oStep.RelativePriority = 3
        oStep.CloseConnection = False
        oStep.ExecuteInMainThread = False
        oStep.IsPackageDSORowset = False
        oStep.JoinTransactionIfPresent = False
        oStep.DisableStep = False
        oStep.FailPackageOnError = False