Solved

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

Posted on 2010-03-11
4
921 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 42

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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 …

821 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