Solved

trouble with .dbf file

Posted on 2004-04-30
7
2,795 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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 125 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now