1

I am working classic ASP project. In this project there is option for users to upload CSV.

Now what is happening is, if I upload CSV file with more than one dot, for example test.13.csv then I get:

The Microsoft Access database engine could not find the object 'test.13.csv'. Make sure the object exists and that you spell its name and the path name correctly

But if I save the same file as test.csv, then it takes file properly.

So can anyone tell me how can I allow my code to accept more than one dot in csv file?

I am using following provider :

sFileDSN = "Provider=" & msdbProviderString() & ";Data Source=" & objFile.Folder & ";Extended Properties=""text;HDR=YES;IMEX=1;MaxScanRows=0;ImportMixedTypes=Text;"""
Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
Ajay
  • 317
  • 2
  • 12
  • 25
  • Did you already try `test_13.csv` to further narrow the problem down on the dot? Also did you check if the file isn't renamed when uploaded? – Filburt Mar 13 '14 at 13:04
  • @Filburt Hi I tried test_13.csv and it works fine but i need to save as test.13.csv. And also file is not renamed when i uplaod. Is there any solution for this?? – Ajay Mar 13 '14 at 13:11
  • What is the value for `msdbProviderString()`? – Filburt Mar 13 '14 at 14:02
  • @Filburt msdbProviderString = "Microsoft.ACE.OLEDB.12.0" – Ajay Mar 13 '14 at 14:15
  • It seems like there is some logic into the file name which could conflict with your naming requirements - see [Microsoft.ACE.OLEDB.12.0 CSV ConnectionString](http://stackoverflow.com/q/5182767/205233) for details. Maybe you should consider to switch to using an underscore instead. – Filburt Mar 13 '14 at 15:15

1 Answers1

0

You can enclose your filename in single quotes like this:

sFileDSN = "Provider='" & msdbProviderString() & "';Data Source=" & objFile.Folder & ";Extended Properties=""text;HDR=YES;IMEX=1;MaxScanRows=0;ImportMixedTypes=Text;"""

Here is a reference, it doesn't specifically mention periods but does address other special characters:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms722656(v=vs.85).aspx

Nathan Rice
  • 3,091
  • 1
  • 20
  • 30