473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

File name problem

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.RPT_8511_3-15-07.CSV

I am doing the following:

Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)

Dim da2 As New OleDb.OleDbDataAdapter("Select * from " &
"PAYROLL.ALLOC.RPT_8511_3-15-07.CSV", conn)
da2.Fill(DTDepartment)

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
Mar 28 '07 #1
2 1147
Standard question #1:
What do you mean by "not working"?

Standard question #2:
What error message do you get?

As I have no error message to go on, I can only guess to the cause, and
I guess that it's the parsing of the connection string that fails rather
than the use of the path.

I don't know if it's supported, but try to put quotes around the path,
just like there are quotes around the extended properties.

tshad wrote:
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.RPT_8511_3-15-07.CSV

I am doing the following:

Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)

Dim da2 As New OleDb.OleDbDataAdapter("Select * from " &
"PAYROLL.ALLOC.RPT_8511_3-15-07.CSV", conn)
da2.Fill(DTDepartment)

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


--
Göran Andersson
_____
http://www.guffa.com
Mar 28 '07 #2
Tom,

Why don't you try renaming the file to something simple and succint before
you open the DataAdapter?

My guess is that the Microsoft Jet Engine ISAM handling doesn't like the "."
or "-" s.
Just because MS File handling and Dot Net can handle them doesn't mean other
MS components will! That would cause too much standardisation and remove too
many challenges :-)

Doug

"tshad" <t@home.comwrote in message
news:ei**************@TK2MSFTNGP06.phx.gbl...
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.RPT_8511_3-15-07.CSV

I am doing the following:

Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)

Dim da2 As New OleDb.OleDbDataAdapter("Select * from " &
"PAYROLL.ALLOC.RPT_8511_3-15-07.CSV", conn)
da2.Fill(DTDepartment)

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


Mar 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Sean Ross | last post by:
Hi. Recently I made a small script to do some file transferring (among other things). I wanted to monitor the progress of the file transfer, so I needed to know the size of the files I was...
11
by: BoonHead, The Lost Philosopher | last post by:
I think the .NET framework is great! It's nice, clean and logical; in contradiction to the old Microsoft. It only saddens me that the new Microsoft still doesn't under stand there own...
3
by: Abhas | last post by:
> > Hi, this is Abhas, > > I had made a video library program in C++, but was facing a problem. > > After entering 12 movies, i cannot enter any more movies. > > Something gibberish comes instead....
5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
4
by: Matt Jensen | last post by:
Howdy I've got a rather strange issue occuring. I used forms based .NET authentication, although I'm also setting some session variables when people login. However, I've found when people use...
2
by: GeoUK | last post by:
Hi All, New member here with a bit of problem. I have read the FAQ's and searched text books but still cannot solve the problem that I have. As part of a course I am doing at University I had...
4
by: robin1983 | last post by:
Hi, i got a problem while uploading a file. I got a code from www.w3schools.com. I try the code, but the problem is that, i cannot specify the path where the file should stored. If i want to stored...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
4
by: liberty1 | last post by:
Hi everyone. I appreciate your effort at helping newbies like me. I have the following problems and will appreciate urgent help. PROBLEM NUMBER 1: Using PHP and MySQL, I am able to upload...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.