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

x
?
Solved

trouble with .dbf file

Posted on 2004-04-30
7
Medium Priority
?
2,914 Views
Last Modified: 2013-11-24
I'm trying to open a dbf file through ASP and it gives me this error:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC dBase Driver] External table is not in the expected format.

If I right click the file in Explorer, then choose Open With, then MS Access, it gives me this error:

Unrecognized Database Format 'D:\myfile.dbf'.

If I go into Access, then click File->Open and select the file, it seems to open it, but then says "External table is not in the expected format".

However, I can open the file in MS Excel and view it perfectly.
So, what's up with this file?

I have Windows 2000 Server and MS Office 2000. Thanks in advance.
0
Comment
Question by:vitanza
  • 3
  • 2
  • 2
7 Comments
 
LVL 31

Expert Comment

by:alorentz
ID: 10964716
Don't think ASP will access DBase without the right driver...
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10964719
Check here for driver script...not sure.

http://www.able-consulting.com/ADO_Conn.htm
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10964833
Use either of the two connection strings..

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\folder;Extended Properties=dBASE IV;User ID=Admin;Password="

"Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\mydbpath;"

Cheers!!

0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:vitanza
ID: 10965021
When I try the first connection string it gives me the same error:

Error Type:
Microsoft JET Database Engine (0x80004005)
External table is not in the expected format.

When I use the second connection string it says the same:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC dBase Driver] External table is not in the expected format.

==============================================

Here is my code:

Dim objConn
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\;"

dim objRS
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.Open "SELECT * FROM MYTABLE", objConn


The error actually does not occur at the connection line - it occurs at the "objRS.Open...." line.
0
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10965051
Try this..

Dim objConn
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\;"

If objConn.State=1 then
dim objRS
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.Open "SELECT * FROM MYTABLE", objConn,1,3
If not objRS.EOF THen
Response.WRite "Success!!"
End If
Else
Response.write "Connection error"
Response.end
End If

Cheers!!
0
 

Author Comment

by:vitanza
ID: 10965086
If I do that it gives me the same error, but if I put "on error resume next" in front of it, it writes "Success!".
Again, the error occurs at the line "objRS.Open..."

By the way, I have several other pages that are accessing a dbf file in the same directory, but I created a System DSN for them. I tried using a DSN at first for this, but no luck. It could possibly be the file, but I can open it in Excel, so I'm not sure....
0
 
LVL 21

Accepted Solution

by:
ap_sajith earned 500 total points
ID: 10965109
Looks like its an issue with memo fields in your dbf files..

Check out this post...

http://www.tek-tips.com/gviewthread.cfm/pid/1252/qid/825675

Cheers!!
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
Viewers will learn the different options available in the Backstage view in Excel 2013.

885 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