Long story short, I needed to pull data from legacy DBF files, on multiple shared locations on the network, via powershell. I have no issues opening them with [System.Data.Odbc] (avoiding the need to install the Jet OLEDB drivers), but am having a small problem with the query.
(1) This works (specifying local path in the query):
ConnectionString = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;"
Query = "SELECT * FROM C:\folder\Test.dbf"
(2) This also works (specifying UNC path in the ConnString):
ConnectionString = "Driver=...; Dbq=\\network\folder;"
Query = "SELECT * FROM Test"
(3) Yet this combination does NOT work (UNC path in the query):
ConnectionString = "Driver=..."
Query = "SELECT * FROM \\network\folder\Test.dbf"
#ERROR [42000] [Microsoft][ODBC dBase Driver] Syntax error in FROM clause."
(3) is my preferred method, as the file list would come in the \\unc\file.dbf
format. This script will eventually be maintained by some other non-technical people, so I'm trying to keep things as simple as possible (no path splitting and multiple rebuilds of the connection string).
I couldn't find anywhere that specifically forbids (3); can someone tell me if it is achievable? Thanks!