Working with CSV with database Activities

Certain amount of customer seems struggle using Database Activities with CSV files.
Hence I created a sample.
Explaining the OleDb Sample(and not explaining the other since the other sample basically follows the same pattern)
First connection string needs to be defined. Connection string contains information about how to connect to the database from the engine side. If the String.Format is unfamiliar, the {0} will be swapped with the second argument of this method which is databaseFileDirectory. The key is the value contained in this variable is not the file itself, but the folder where file of interest is stored.
String.Format(“Provider=Microsoft.Jet.OLEDB.4.0; Data Source=”“{0}”“; Extended Properties=”“text;HDR=NO;FORMAT=Delimited”“”,databaseFileDirectory)

The file of interest is actually specified during query
String.Format(“SELECT * FROM [{0}]”,“test.csv”)

Configuring your own connection should be straight forward using the sample.

As a side note,
I’m am not aware of pros and cons between using Database Activity versus Generate Data Table Activity. If a knowledgeable person can comment that will be amazing.
DatabaseActivitySample.zip (4.4 KB)

I will close this after a while.

1 Like