I found that if I do a select from .csv file, it won't work if the filename
has "." or "-" in them such as:
PAYROLL.ALLOC.R PT_8511_3-15-07.CSV
I am doing the following:
Dim ConStr As String = _
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & _
path & ";Extended Properties=""Te xt;HDR=No;FMT=D elimited\"""
Dim conn As New OleDb.OleDbConn ection(ConStr)
Dim da2 As New OleDb.OleDbData Adapter("Select * from " &
"PAYROLL.ALLOC. RPT_8511_3-15-07.CSV", conn)
da2.Fill(DTDepa rtment)
If I replace 1st 2 periods (".") and dashes with underscores it works fine.
But this works:
If f.Exists(path & "PAYROLL.ALLOC. RPT_8511_3-15-07.CSV") Then
And this works:
objStreamWriter = New StreamWriter(
"PAYROLL.ALLOC. RPT_8511_3-15-07.CSV")
I assume that the periods and dashes are illegal characters for a file name
in the Select statement but why not in the other cases?
The problem is that I am getting this file from a Java system and that is
what they are calling their filename. Is there a way around this?
Thanks,
Tom
has "." or "-" in them such as:
PAYROLL.ALLOC.R PT_8511_3-15-07.CSV
I am doing the following:
Dim ConStr As String = _
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & _
path & ";Extended Properties=""Te xt;HDR=No;FMT=D elimited\"""
Dim conn As New OleDb.OleDbConn ection(ConStr)
Dim da2 As New OleDb.OleDbData Adapter("Select * from " &
"PAYROLL.ALLOC. RPT_8511_3-15-07.CSV", conn)
da2.Fill(DTDepa rtment)
If I replace 1st 2 periods (".") and dashes with underscores it works fine.
But this works:
If f.Exists(path & "PAYROLL.ALLOC. RPT_8511_3-15-07.CSV") Then
And this works:
objStreamWriter = New StreamWriter(
"PAYROLL.ALLOC. RPT_8511_3-15-07.CSV")
I assume that the periods and dashes are illegal characters for a file name
in the Select statement but why not in the other cases?
The problem is that I am getting this file from a Java system and that is
what they are calling their filename. Is there a way around this?
Thanks,
Tom
Comment