Solved

error when the .DBF filename have a underscore in a OLEDB SQL Query

Posted on 2010-03-11
4
910 Views
Last Modified: 2013-11-24
Hi experts,

I Must access the .DBF but in the name of the DBF file I’ve “underscore” like : CMSDB_ACT.DBF

But the code don't work with the underscore...

If I remove it, the code work, but I can do that, this is a DBF of a external software.

Can you help me ?

Kind Regards, Didier
Dim sCon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\Winbooks\Data\CMSDB;Extended Properties=dBASE IV;"
Dim con As New OleDbConnection(sCon)
Dim sql_winbooks As New OleDbCommand("SELECT * FROM CMSDB_ACT.DBF WHERE ISMATCHED = 0", con)
con.Open()
Dim dr_winbooks As OleDbDataReader = sql_winbooks.ExecuteReader

Open in new window

0
Comment
Question by:figmentbe
  • 2
4 Comments
 
LVL 13

Expert Comment

by:sameer2010
ID: 27635322
Why are you specifying .DBF in your query? Also, should your data source not have extension?
0
 

Author Comment

by:figmentbe
ID: 27635596
Yes the data source have the extension

I've try without the extension, and I've the same error message :

The Microsoft Jet database engine could not find the object 'CMSDB_ACT'.  Make sure the object exists and that you spell its name and the path name correctly.
0
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 27635674
Jet OLE DB provider does not support long file names but requires 8.3 DOS name format...

So, you have to look what short name was assigned to your DBF (you may use e.g. DIR *.DBF /X  in Command window)

Possible example is:

Dim sql_winbooks As New System.Data.OleDb.OleDbCommand("SELECT * FROM [CMSDB_~1] WHERE ISMATCHED = 0", con)

Square brackets are necessary because of ~ character in name, possible DBF extension is not necessary.
0
 

Author Closing Comment

by:figmentbe
ID: 31701792
Many Thanks, that's ok !!!!


0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question