G
ge0193387
I have a csv file here that is output from another program. Once this
csv has been completed the information needs to be extracted in
multiple formats into a formatted excel spreadsheet (sheet a is
ordered a certain way with specific information and summary rows, ...)
I created the code listed below and tested it multiple times with
success. After which I ported the code to another application and it
ceased working. At first I thought the problem was with the file
being on a network location so I copied the file locally (and
schema.ini).
Dim CMD As OdbcCommand
Dim ConnDir As String = CSVFileName.Substring(0,
CSVFileName.LastIndexOf("\") + 1)
Dim Conn As New OdbcConnection("Driver={Microsoft Text Driver (*.txt;
*.csv)};Dbq=" & ConnDir & ";Extensions=asc,csv,tab,txt;")
'IMEX=1;Persist Security Info=False")
Dim DR As OdbcDataReader
Dim SQL As String = "SELECT * FROM " & CSVFileName.Trim & " ORDER BY
PCN"
CMD = New OdbcCommand(SQL, Conn)
Conn.Open()
DR = CMD.ExecuteReader
'ERROR [42S02] [Microsoft][ODBC Text Driver] The Microsoft Jet
database engine could not find the object 'file.csv'. Make sure the
object exists and that you spell its name and the path name correctly.
One of the first responses I expect to see - "Is the file locked?"
A: I'm not sure how to check that but since the same code worked
before I don't see how
Any assistance is appreciated.
Christian
csv has been completed the information needs to be extracted in
multiple formats into a formatted excel spreadsheet (sheet a is
ordered a certain way with specific information and summary rows, ...)
I created the code listed below and tested it multiple times with
success. After which I ported the code to another application and it
ceased working. At first I thought the problem was with the file
being on a network location so I copied the file locally (and
schema.ini).
Dim CMD As OdbcCommand
Dim ConnDir As String = CSVFileName.Substring(0,
CSVFileName.LastIndexOf("\") + 1)
Dim Conn As New OdbcConnection("Driver={Microsoft Text Driver (*.txt;
*.csv)};Dbq=" & ConnDir & ";Extensions=asc,csv,tab,txt;")
'IMEX=1;Persist Security Info=False")
Dim DR As OdbcDataReader
Dim SQL As String = "SELECT * FROM " & CSVFileName.Trim & " ORDER BY
PCN"
CMD = New OdbcCommand(SQL, Conn)
Conn.Open()
DR = CMD.ExecuteReader
'ERROR [42S02] [Microsoft][ODBC Text Driver] The Microsoft Jet
database engine could not find the object 'file.csv'. Make sure the
object exists and that you spell its name and the path name correctly.
One of the first responses I expect to see - "Is the file locked?"
A: I'm not sure how to check that but since the same code worked
before I don't see how
Any assistance is appreciated.
Christian