Solved

trouble with .dbf file

Posted on 2004-04-30
7
2,862 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
[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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Suggested Courses

631 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