我在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
但是在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
解决方案 »
- 比较名称找出没有名称的Index
- 如何在vb和sql连接的程序执行时,动态的显示程序执行的过程,并且能暂停查看当前,点击继续运行时继续执行
- 如何开发内嵌浏览器的vb程序才不会报毒。
- 一个错误的处理向各位高手请教???
- 100分求教
- IE工具栏上右边的动画是怎什做的,是GIF动画吗?怎么实现?求控件?
- 求助,高手请进
- 关于datareport的一个菜鸟问题!!!!!!!!!!!!!
- 再问 ?不知哪位大虾能给小弟一份能在WinXP中正常读取和写入注册表内容的代码?小弟以分相谢!!!!
- 如何在打印预览前通过代码指定水晶报表的打印机和纸张大小以及纸张来源
- 如何确定二台电脑是连通的
- 请问怎么用打印机打印条形码呢?
你有在工程中引用DTS吗?