473,654 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.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
Mar 28 '07 #1
1 1353
On Mar 28, 7:21 pm, "tshad" <t...@home.comw rote:
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
Enclose the name in square brackets

Select * from [PAYROLL.ALLOC.R PT_8511_3-15-07.CSV]

Mar 28 '07 #2

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

Similar topics

17
23156
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 transferring. Finding out how to get this information took some time (reading the manuals - googling did not prove worthwhile). Anyway, I did eventually figure out how to do it (there are a few ways, including os.path.getsize(filename)). My...
11
3621
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 rules when it comes to file paths. A lot of Microsoft installers for example, and also installers of other companies, do not work because they handle paths in the following manner:
3
2703
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. > > Can somebody please tell whats wrong?? > > This is the code : : #include<fstream.h> #include<conio.h>
5
11025
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 setting stDataSource and stFileName to the desired values. Most of the time it works, but occasionally, typically as code changes are being made to the module, the following message appears:
0
3930
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. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
4
4473
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 one of my webform pages which includes a button that pops up a window where you can upload files, if you upload files in this popup window, it seems to somehow clear out all of the session variables and the users get logged out. However, if...
2
1741
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 to write a program in C++ that would allow the user to enter student information (matriculation number, name, status and mark), which was then stored in an array. They could then search it or list it. Everything was woking (and still is) up to here....
4
7406
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 the file as "C:\wamp\www\practices" then what will be the syntax.. please to tell me in the following code. This is my HTML file <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author"...
185
7004
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 return the file name given a FILE *. Questions: What would be the best name for this function?
4
2943
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 picture successfully unto the server but not so with the file name of the picture even though other parameters in my form got inserted successfuly in the database. I have read several posts on this topic including here on this site but I can't get around...
0
8372
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8285
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8475
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7304
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5621
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.