Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-03-11
4
Medium Priority
?
942 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 43

Accepted Solution

by:
pcelba earned 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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…

722 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