![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there any way to pass a file name to a DTS Package? I'm using a DTS.Package2 object in VB6 (using LoadFromSQLServer etc.). The package imports an Excel file into a SQL2000 table. When I created the DTS import I specified a file name, but I'd like to be able to override it in code. Thanks-Tom |
#3
| |||
| |||
|
|
What about oPkg.Connections("My Excel Connection").DataSource = "Path and file name" Is there any way to pass a file name to a DTS Package? I'm using a DTS.Package2 object in VB6 (using LoadFromSQLServer etc.). The package imports an Excel file into a SQL2000 table. When I created the DTS import I specified a file name, but I'd like to be able to override it in code. Thanks-Tom |
#4
| |||
| |||
|
|
You got me on the right trail. I'm getting this error though: Step "Copy Data from Sheet1$ to [Inventory].[dbo].[ManufacturerShortagesTemp] Step" Failed - Error: -2147467259 Source: Microsoft OLE DB Provider for SQL Server Description: [DBNETLIB][ConnectionOpen (ParseConnectParams()).]Invalid connection. Here's the code I'm using: Set dtsConnect = dtsPackage.Connections.New("SQLOLEDB") With dtsConnect .ID = 1 .DataSource = "Connection 1" .UseTrustedConnection = True End With Call dtsPackage.Connections.Add(dtsConnect) dtsPackage.Connections(1).DataSource = FILE_PATH & "\Manufacturer Shorts\VSPR_update.xls" ' Load Package dtsPackage.LoadFromSQLServer "EUHRXINV2", "mrxgtm", , DTSSQLStgFlag_Default, , , , "Import Manufacturer Shorts" dtsPackage.Execute I figure my problem is either in: Set dtsConnect = dtsPackage.Connections.New("SQLOLEDB") or .DataSource = "Connection 1" "Connection 1" is what the DTS package is using (a wild stab on my part) Thanks for your help...Tom "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message news:eLJGjlqGFHA.4084 (AT) TK2MSFTNGP14 (DOT) phx.gbl... What about oPkg.Connections("My Excel Connection").DataSource = "Path and file name" Is there any way to pass a file name to a DTS Package? I'm using a DTS.Package2 object in VB6 (using LoadFromSQLServer etc.). The package imports an Excel file into a SQL2000 table. When I created the DTS import I specified a file name, but I'd like to be able to override it in code. Thanks-Tom |
![]() |
| Thread Tools | |
| Display Modes | |
| |