Solved

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

Posted on 2010-03-11
4
933 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

632 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