File Access issues using Jet Engine and IO.File.Open

0

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.

.net
vb.net
asked on Stack Overflow Jul 2, 2018 by Abe Gold • edited Jul 2, 2018 by Abe Gold

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0