I opened a file using
FS = File.Open(GLFile, FileMode.Open, FileAccess.Write, FileShare.Read)
Elsewhere in the code I read the file to a Datatable using Microsoft.Jet
Dim CnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & GLFolder & ";Extended Properties=""text;HDR=Yes;Mode=Read;ReadOnly=True;FMT=Delimited;IMEX=1
Using Adp As New OleDb.OleDbDataAdapter($"Select ..... from [{fileName}.csv]", CnStr)
Adp.Fill(wb)
End Using
If I run two instances of the program, the second instance is throwing an error "System.Data.OleDb.OleDbException (0x80004005): The Microsoft Jet database engine cannot open the file ''. It is already opened exclusively by another user, or you need permission to view its data." although the File.Open used FileShare.Read in the first instance.
Any guidance as to what I'm missing would be greatly appreciated.
User contributions licensed under CC BY-SA 3.0