Solved

trouble with .dbf file

Posted on 2004-04-30
7
2,815 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
onenote 2016 sync 40 235
HxTsr.exe consuming resources 2 418
Adding to open record on form, from unbound textbox 4 49
FileUp - Classic ASP 5 17
MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
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.

776 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