473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DTS pkg VB6 to VB.Net problems - Sql Srv2000

Hello,

I created a DTS package VB6 script with DTS from Sql
Server 2000. In a vb.net project I add a reference to
Microsoft DTSpackage object library and copy the code from
the DTS script to a module in the vb.net project. The
following lines of code are a few of the lines with syntax
issues and the description of the issue (below that is the
sub (DTSrun) that these lines came from). My request is
if someone could explain how to fix the syntax (I'm just
trying to save a few hours of hacking from picking
whatever from the dropdown lists until something works).
Plus, some of the messages are suggesting an Interface
problem - do I need to implement some kind of interface?
(I appologize in advance for my ignorance)

Option Strict On
Option Explicit On
Option Compare Binary

Imports DTS
Imports System.Data.SqlClient

Module ModDTS

Public goPackageOld As New DTS.Package
Public goPackage As DTS.Package2

Public Sub DTSrun()

goPackage = goPackageOld <----- prob here

-->Option Strict On disallows implicit conversions from
DTS.Package to DTS.Package2
....

goPackage.TransactionIsolationLevel = 4096 <---- prob

-->Option Strict On disallows implicit conversions from
Integer to DTS.DTSIsolationLevel
....

oConnection.ConnectionProperties("Mode") = 1 <--- prob

-->Interface 'DTS.OleDBProperties' cannot be indexed
because it has no default properties
-->what Interface do I need to implement for this?
....

*********************************************
Public Sub tracePackageError(ByVal oPackage As DTS.Package)
Dim ErrorCode As Long
Dim ErrorSource As String
Dim ErrorDescription As String
Dim ErrorHelpFile As String
Dim ErrorHelpContext As Long
Dim ErrorIDofInterfaceWithError As String
Dim i As Integer

For i = 1 To oPackage.Steps.Count
If oPackage.Steps(i).ExecutionResult =
DTSStepExecResult_Failure Then ...

-->Name 'DTSStepExecResult_Failure' is not declared

-->where do I get the constants for this?

************************************************** ****
************************************************** ****

-->here is all of sub DTSrun - minus the create columns
part

Option Strict On
Option Explicit On
Option Compare Binary

Imports DTS
Imports System.Data.SqlClient

Module ModDTS

Public goPackageOld As New DTS.Package
Public goPackage As DTS.Package2

Public Sub DTSrun()
goPackage = goPackageOld
goPackage.Name = "samplePkg1b"
goPackage.Description = "DTS package description"
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

oConnection = goPackage.Connections.New("DTSFlatFile")

oConnection.ConnectionProperties("Data Source")
= "C:\sample1a.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.ConnectionProperties("Max characters per
delimited column") = 8000

oConnection.Name = "Connection 1"
oConnection.ID = 1
oConnection.Reusable = True
oConnection.ConnectImmediate = False
oConnection.DataSource = "F:\Adonet\sample1a.txt"
oConnection.ConnectionTimeout = 60
oConnection.UseTrustedConnection = False
oConnection.UseDSL = False

goPackage.Connections.Add(oConnection)
oConnection = Nothing

oConnection = goPackage.Connections.New("SQLOLEDB")
oConnection.ConnectionProperties("Integrated Security")
= "SSPI"
oConnection.ConnectionProperties("Persist Security Info")
= True
oConnection.ConnectionProperties("Initial Catalog")
= "LATOS"
oConnection.ConnectionProperties("Data Source") = "mySvr"
oConnection.ConnectionProperties("Application Name")
= "DTS Import/Export Wizard"

oConnection.Name = "Connection 2"
oConnection.ID = 2
oConnection.Reusable = True
oConnection.ConnectImmediate = False
oConnection.DataSource = "mySrv"
oConnection.ConnectionTimeout = 60
oConnection.Catalog = "LATOS"
oConnection.UseTrustedConnection = True
oConnection.UseDSL = False

goPackage.Connections.Add(oConnection)
oConnection = Nothing

' create package steps information

Dim oStep As DTS.Step2
Dim oPrecConstraint As DTS.PrecedenceConstraint

'------------- a new step defined below

oStep = goPackage.Steps.New

oStep.Name = "Copy Data from sample1a to [myDB].[dbo].
[sample1a] Step"
oStep.Description = "Copy Data from sample1a to [myDB].
[dbo].[sample1a] Step"
oStep.ExecutionStatus = 1
oStep.TaskName = "Copy Data from sample1a to [myDB].[dbo].
[sample1a] Task"
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

goPackage.Steps.Add(oStep)
oStep = Nothing
' create package tasks information

'------------- call Task_Sub1 for task Copy Data from
sample1a to [myDB].[dbo].[sample1a] Task (Copy Data from
sample1a to [myDB].[dbo].[sample1a] Task)

Call Task_Sub1(goPackage)

' Save or execute package

'goPackage.SaveToSQLServer "(local)", "sa", ""
goPackage.Execute()
tracePackageError(goPackage)
goPackage.UnInitialize()

goPackage = Nothing

goPackageOld = Nothing

End Sub
*************************************
' error reporting using step.GetExecutionErrorInfo after
execution

Public Sub tracePackageError(ByVal oPackage As DTS.Package)
Dim ErrorCode As Long
Dim ErrorSource As String
Dim ErrorDescription As String
Dim ErrorHelpFile As String
Dim ErrorHelpContext As Long
Dim ErrorIDofInterfaceWithError As String
Dim i As Integer

For i = 1 To oPackage.Steps.Count
If oPackage.Steps(i).ExecutionResult =
DTSStepExecResult_Failure Then
oPackage.Steps(i).GetExecutionErrorInfo(ErrorCode,
ErrorSource, ErrorDescription, _
ErrorHelpFile, ErrorHelpContext,
ErrorIDofInterfaceWithError)
MsgBox(oPackage.Steps(i).Name & " failed" & vbCrLf &
ErrorSource & vbCrLf & ErrorDescription)
End If
Next i

End Sub
....
End Module

Thanks,
Rich
Nov 20 '05 #1
1 3847
The DTS script works fine in VB6. So I suppose an
alternative would be to compile this to an exe and call it
from my vb.net project. Should I use shell or what is the
best way to call the exe from the .net proj?

Thanks,
Rich
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jerome Lefebvre | last post by:
Hello, Hope this will interest a few. I been working with a friend on the problems given out during the "International Collegiate Programming Contest" (ICPC) http://icpc.baylor.edu/icpc/ ....
14
by: Jim Hubbard | last post by:
Are you up to speed on the difficulties in using the 1.1 .Net framework? Not if you are unaware of the 1,596 issues listed at KBAlertz (http://www.kbalertz.com/technology_3.aspx). If you are...
1
by: 3f | last post by:
Hello; We have made a web application that people can download from our web site and installed on: Windows XP Windows 2000 Professional Windows 2003 Server Windows 2000 Server
5
by: Corky | last post by:
This works: db2 SELECT DISTINCT PROBLEM_OBJECTS.PROBLEM_ID FROM PROBLEM_OBJECTS INNER JOIN PROBLEMS ON PROBLEM_OBJECTS.PROBLEM_ID = PROBLEMS.PROBLEM_ID WHERE INTEGER(DAYS(CURRENT DATE) -...
2
by: Ellen Graves | last post by:
I am having a lot of problems with DB2 8.3.1 on RH Linux AS2.1. Installing and running stored procedures is problematic. Stored procedures I have used for years on V7 on WinNT are now failing...
19
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
0
by: Sergistm | last post by:
Hello World, :D I have a problem that it is making me crazy, I hope you can help me. I'm trying to execute a .exe file with the Procces.Start, and there is no problem when the file is on my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.