Run DTS Package without specified filename or path with

Good Morning! Another 5 inches fell last night. I gave up on the snow blower because the snow was relatively light. We are suppose to get nailed on Thursday, Sunday and Tuesday. I’d say our chances of a green Christmas this year are pretty good. My Dominican trip can’t get here fast enough.

Today’s topic is using a DTS package for SQL 2000 in your application without requiring a specific filename or path from your users. Yes, SQL 2000 is old but a lot of us still have to use it. Hope you find it useful and make it a great day!

‘ Copy the file that the user wishes to import into the required location
        Dim STR_file1 As String
        If OFD_import.ShowDialog() = DialogResult.OK Then
            Dim STR_FilePathAndName As String = OFD_import.FileName
            STR_file1 = "C:\Import\Import.txt"
            ‘ Remove the file from the import folder – this file cannot exist a new one is copied over
            If System.IO.File.Exists(STR_file1) = True Then
            End If
            ‘ Copy the file to the import folder
            If System.IO.File.Exists(STR_FilePathAndName) = True Then
                System.IO.File.Copy(STR_FilePathAndName, STR_file1)
            End If
            ‘ Run the DTS package
            Dim oPackage As DTS.Package = New DTS.Package()
            oPackage.LoadFromSQLServer( _
                ServerName:="SQLSVR1", _
                Flags:=DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, _
                PackageName:="Part Manager Import")
            oPackage = Nothing


Technorati Tags: ,,,,,,,,,,,,,,,,,,,,,,,,,,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: