Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 952
  • Last Modified:

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

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
figmentbe
Asked:
figmentbe
  • 2
1 Solution
 
sameer2010Commented:
Why are you specifying .DBF in your query? Also, should your data source not have extension?
0
 
figmentbeAuthor Commented:
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
 
pcelbaCommented:
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
 
figmentbeAuthor Commented:
Many Thanks, that's ok !!!!


0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now