Click here to Skip to main content
16,005,339 members
Home / Discussions / C#
   

C#

 
GeneralC# Resize a control question Pin
elapid6-Apr-05 10:39
elapid6-Apr-05 10:39 
GeneralRe: C# Resize a control question Pin
Christian Graus6-Apr-05 18:57
protectorChristian Graus6-Apr-05 18:57 
GeneralHiding a DataColumn in a DataGrid Pin
obelisk296-Apr-05 10:38
obelisk296-Apr-05 10:38 
GeneralRe: Hiding a DataColumn in a DataGrid Pin
Kodanda Pani6-Apr-05 17:06
Kodanda Pani6-Apr-05 17:06 
GeneralRe: Hiding a DataColumn in a DataGrid Pin
Luis Alonso Ramos6-Apr-05 17:15
Luis Alonso Ramos6-Apr-05 17:15 
GeneralCreating a dynamic Windows Service... Pin
jabaron136-Apr-05 9:42
jabaron136-Apr-05 9:42 
Generalproblems with Overlapped IO WriteFile() Pin
Member 16244276-Apr-05 9:18
Member 16244276-Apr-05 9:18 
GeneralCreating and running DTS Packages in C# Pin
JMichael24686-Apr-05 6:22
JMichael24686-Apr-05 6:22 
In VB I was able to create and run DTS packages. Howerver, I can't seem to convert the code I have over to C#. Here is a sample of the VB code that is generated from SQL, can someone please explain to me how I can convert my existing VB code to C#. DTS is a plays a pretty big role in the way we move data and I need to be able to create and run DTS packages at run time.

<br />
Public goPackageOld As New DTS.Package<br />
Public goPackage As DTS.Package2<br />
Private Sub Main()<br />
        Set goPackage = goPackageOld <---here is where the troubles begin<br />


I am also having troubles with the properties giving errors as well. They are generally cannot implicitly convert errors. Anyone here have any experience with DTS that can help me find a solution?

<br />
'****************************************************************<br />
'Microsoft SQL Server 2000<br />
'Visual Basic file generated for DTS Package<br />
'File Name: C:\BCPTest\SamplteDTSPackage.bas<br />
'Package Name: SamplteDTSPackage<br />
'Package Description: DTS package description<br />
'Generated Date: 4/6/2005<br />
'Generated Time: 11:53:19 AM<br />
'****************************************************************<br />
<br />
Option Explicit<br />
Public goPackageOld As New DTS.Package<br />
Public goPackage As DTS.Package2<br />
Private Sub Main()<br />
        Set goPackage = goPackageOld<br />
<br />
        goPackage.Name = "SamplteDTSPackage"<br />
        goPackage.Description = "DTS package description"<br />
        goPackage.WriteCompletionStatusToNTEventLog = False<br />
        goPackage.FailOnError = False<br />
        goPackage.PackagePriorityClass = 2<br />
        goPackage.MaxConcurrentSteps = 4<br />
        goPackage.LineageOptions = 0<br />
        goPackage.UseTransaction = True<br />
        goPackage.TransactionIsolationLevel = 4096<br />
        goPackage.AutoCommitTransaction = True<br />
        goPackage.RepositoryMetadataOptions = 0<br />
        goPackage.UseOLEDBServiceComponents = True<br />
        goPackage.LogToSQLServer = False<br />
        goPackage.LogServerFlags = 0<br />
        goPackage.FailPackageOnLogFailure = False<br />
        goPackage.ExplicitGlobalVariables = False<br />
        goPackage.PackageType = 0<br />
        <br />
<br />
Dim oConnProperty As DTS.OleDBProperty<br />
<br />
'---------------------------------------------------------------------------<br />
' create package connection information<br />
'---------------------------------------------------------------------------<br />
<br />
Dim oConnection As DTS.Connection2<br />
<br />
'------------- a new connection defined below.<br />
'For security purposes, the password is never scripted<br />
<br />
Set oConnection = goPackage.Connections.New("Microsoft.Jet.OLEDB.4.0")<br />
<br />
        oConnection.ConnectionProperties("Data Source") = "C:\DTSTEST\myDB.MDB"<br />
        oConnection.ConnectionProperties("Mode") = 1<br />
        <br />
        oConnection.Name = "Connection 1"<br />
        oConnection.ID = 1<br />
        oConnection.Reusable = True<br />
        oConnection.ConnectImmediate = False<br />
        oConnection.DataSource = "C:\DTSTEST\myDB.MDB"<br />
        oConnection.ConnectionTimeout = 60<br />
        oConnection.UseTrustedConnection = False<br />
        oConnection.UseDSL = False<br />
        <br />
        'If you have a password for this connection, please uncomment and add your password below.<br />
        'oConnection.Password = "<put the password here>"<br />
<br />
goPackage.Connections.Add oConnection<br />
Set oConnection = Nothing<br />
<br />
'------------- a new connection defined below.<br />
'For security purposes, the password is never scripted<br />
<br />
Set oConnection = goPackage.Connections.New("SQLOLEDB")<br />
<br />
        oConnection.ConnectionProperties("Integrated Security") = "SSPI"<br />
        oConnection.ConnectionProperties("Persist Security Info") = True<br />
        oConnection.ConnectionProperties("Initial Catalog") = "BMS"<br />
        oConnection.ConnectionProperties("Data Source") = "DEVServer\DEVServer"<br />
        oConnection.ConnectionProperties("Application Name") = "DTS  Import/Export Wizard"<br />
        <br />
        oConnection.Name = "Connection 2"<br />
        oConnection.ID = 2<br />
        oConnection.Reusable = True<br />
        oConnection.ConnectImmediate = False<br />
        oConnection.DataSource = "DEVServer\DEVServer"<br />
        oConnection.ConnectionTimeout = 60<br />
        oConnection.Catalog = "BMS"<br />
        oConnection.UseTrustedConnection = True<br />
        oConnection.UseDSL = False<br />
        <br />
        'If you have a password for this connection, please uncomment and add your password below.<br />
        'oConnection.Password = "<put the password here>"<br />
<br />
goPackage.Connections.Add oConnection<br />
Set oConnection = Nothing<br />
<br />
'------------- a new connection defined below.<br />
'For security purposes, the password is never scripted<br />
<br />
Set oConnection = goPackage.Connections.New("Microsoft.Jet.OLEDB.4.0")<br />
<br />
        oConnection.ConnectionProperties("Data Source") = "C:\DTSTEST\myDB.MDB"<br />
        oConnection.ConnectionProperties("Mode") = 1<br />
        <br />
        oConnection.Name = "Connection 3"<br />
        oConnection.ID = 3<br />
        oConnection.Reusable = True<br />
        oConnection.ConnectImmediate = False<br />
        oConnection.DataSource = "C:\DTSTEST\myDB.MDB"<br />
        oConnection.ConnectionTimeout = 60<br />
        oConnection.UseTrustedConnection = False<br />
        oConnection.UseDSL = False<br />
        <br />
        'If you have a password for this connection, please uncomment and add your password below.<br />
        'oConnection.Password = "<put the password here>"<br />
<br />
goPackage.Connections.Add oConnection<br />
Set oConnection = Nothing<br />
<br />
'------------- a new connection defined below.<br />
'For security purposes, the password is never scripted<br />
<br />
Set oConnection = goPackage.Connections.New("SQLOLEDB")<br />
<br />
        oConnection.ConnectionProperties("Integrated Security") = "SSPI"<br />
        oConnection.ConnectionProperties("Persist Security Info") = True<br />
        oConnection.ConnectionProperties("Initial Catalog") = "MyTestDB"<br />
        oConnection.ConnectionProperties("Data Source") = "DEVServer\DEVServer"<br />
        oConnection.ConnectionProperties("Application Name") = "DTS  Import/Export Wizard"<br />
        <br />
        oConnection.Name = "Connection 4"<br />
        oConnection.ID = 4<br />
        oConnection.Reusable = True<br />
        oConnection.ConnectImmediate = False<br />
        oConnection.DataSource = "DEVServer\DEVServer"<br />
        oConnection.ConnectionTimeout = 60<br />
        oConnection.Catalog = "BMS"<br />
        oConnection.UseTrustedConnection = True<br />
        oConnection.UseDSL = False<br />
        <br />
        'If you have a password for this connection, please uncomment and add your password below.<br />
        'oConnection.Password = "<put the password here>"<br />
<br />
goPackage.Connections.Add oConnection<br />
Set oConnection = Nothing<br />
<br />
'---------------------------------------------------------------------------<br />
' create package steps information<br />
'---------------------------------------------------------------------------<br />
<br />
Dim oStep As DTS.Step2<br />
Dim oPrecConstraint As DTS.PrecedenceConstraint<br />
<br />
'------------- a new step defined below<br />
<br />
Set oStep = goPackage.Steps.New<br />
<br />
        oStep.Name = "Copy Data from tablename to [BMS].[dbo].[idxBillingNumber] Step"<br />
        oStep.Description = "Copy Data from tablename to [BMS].[dbo].[idxBillingNumber] Step"<br />
        oStep.ExecutionStatus = 1<br />
        oStep.TaskName = "Copy Data from tablename to [BMS].[dbo].[idxBillingNumber] Task"<br />
        oStep.CommitSuccess = False<br />
        oStep.RollbackFailure = False<br />
        oStep.ScriptLanguage = "VBScript"<br />
        oStep.AddGlobalVariables = True<br />
        oStep.RelativePriority = 3<br />
        oStep.CloseConnection = False<br />
        oStep.ExecuteInMainThread = True<br />
        oStep.IsPackageDSORowset = False<br />
        oStep.JoinTransactionIfPresent = False<br />
        oStep.DisableStep = False<br />
        oStep.FailPackageOnError = False<br />
        <br />
goPackage.Steps.Add oStep<br />
Set oStep = Nothing<br />
<br />
'---------------------------------------------------------------------------<br />
' create package tasks information<br />
'---------------------------------------------------------------------------<br />
<br />
Call Task_Sub1(goPackage)<br />
<br />
'---------------------------------------------------------------------------<br />
' Save or execute package<br />
'---------------------------------------------------------------------------<br />
<br />
'goPackage.SaveToSQLServer "(local)", "sa", ""<br />
goPackage.Execute<br />
tracePackageError goPackage<br />
goPackage.Uninitialize<br />
'to save a package instead of executing it, comment out the executing package line above and uncomment the saving package line<br />
Set goPackage = Nothing<br />
<br />
Set goPackageOld = Nothing<br />
<br />
End Sub<br />
<br />

GeneralRe: Creating and running DTS Packages in C# Pin
Jon Sagara6-Apr-05 9:33
Jon Sagara6-Apr-05 9:33 
GeneralRe: Creating and running DTS Packages in C# Pin
J4amieC6-Apr-05 11:09
J4amieC6-Apr-05 11:09 
GeneralRe: Creating and running DTS Packages in C# Pin
JMichael24684-Aug-05 6:16
JMichael24684-Aug-05 6:16 
GeneralProblem with Invoke Pin
Snowjim6-Apr-05 6:13
Snowjim6-Apr-05 6:13 
GeneralRe: Problem with Invoke Pin
afinnell7-Apr-05 6:35
afinnell7-Apr-05 6:35 
GeneralMaking an app color space aware Pin
ehcseapine6-Apr-05 5:50
ehcseapine6-Apr-05 5:50 
QuestionHow to dial a computer? Pin
yateee6-Apr-05 5:47
yateee6-Apr-05 5:47 
GeneralEvent problem Pin
_eulogy_6-Apr-05 5:44
_eulogy_6-Apr-05 5:44 
GeneralRe: Event problem Pin
afinnell7-Apr-05 6:39
afinnell7-Apr-05 6:39 
GeneralRe: Event problem Pin
_eulogy_7-Apr-05 8:16
_eulogy_7-Apr-05 8:16 
GeneralRe: Event problem Pin
afinnell8-Apr-05 14:14
afinnell8-Apr-05 14:14 
GeneralRe: Event problem Pin
_eulogy_9-Apr-05 1:02
_eulogy_9-Apr-05 1:02 
GeneralEnvironment Error Pin
Sabry19056-Apr-05 5:25
Sabry19056-Apr-05 5:25 
Generalinsert data to oracle table Pin
IvyLee6-Apr-05 5:19
IvyLee6-Apr-05 5:19 
GeneralFormat a STRING into a FLOAT Pin
Seraphin6-Apr-05 4:56
Seraphin6-Apr-05 4:56 
GeneralRe: Format a STRING into a FLOAT Pin
Tom Larsen6-Apr-05 5:14
Tom Larsen6-Apr-05 5:14 
GeneralRe: Format a STRING into a FLOAT Pin
Seraphin6-Apr-05 5:22
Seraphin6-Apr-05 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.