Hello,
I am currently working on a VB.NET desktop application that uses .mdb (Access) database files on the backend. The .mdb files are opened and edited in the VB.NET app. Once editing is completed, the users will need to import the data into our SQL Server database. This is an easy task, until you try to introduce the dynamic filepath scenario.
I have a fair amount of experience with SSIS but am having some trouble with approaching this. I have created a WinForm that allows the user to browse to the .mdb file of their choice. The .mdb filenames have timestamp/date information in them, to make them unique. (I did not develop this part of the app, I recently began working on this, hence the problems. I would not timestamp an .mdb filename but this is what Im forced to use!).
Anyways, I need to pass the filename and path to my SSIS package, dynamically. I see where you create variables for ConnectionString, etc. But I am really unsure of the details and what type of Data Connection I should use for MS Access (Ole DB, ODBC, or Jet 4.0 for Office?? sheesh there are a lot!!)
I also assume that my data connection's connection string must be dynamic, since the package will use the .mdb file as the SOURCE. But how do you create a dynamic data connection in SSIS for .mdb files?
And how do I pass the filename/path string to my SSIS package?
I am currently prototyping with this code:
'Execute the SSIS_Import package
Dim pkgLocation As String
Dim pkg As New Package
Dim app As New Microsoft.SqlServer.Dts.Runtime.Application
Dim pkgResults As DTSExecResult
Dim eventListener As New EventListener()
Try
pkgLocation = "C:\SSIS_DataTransfer\ImportPackage.dtsx"
'TO-DO: pass databasePath variable to SSIS package here ???
pkg = app.LoadPackage(pkgLocation, eventListener)
pkgResults = pkg.Execute(Nothing, Nothing, eventListener, Nothing, Nothing)
Select Case pkgResults
Case DTSExecResult.Completion
MsgBox("Data import completed!")
Case DTSExecResult.Success
MsgBox("Data import was successful!")
Case DTSExecResult.Failure
MsgBox("Data import was not successful!")
End Select
Catch ex As Exception
MsgBox(ex.Message)
End Try
- How do I pass the .mdb file location to my SSIS package? LoadPackage maybe?
- How do I use the dynamic file location in my Data Connection for my SSIS package?
It is quite simple to upload an .mdb file that is NOT dynamic. Setting the source and destination is quite easy until you introduce the DYNAMIC aspect of user selection. How is this possible in SSIS?
any help is greatly appreciated. Thank you.