Solved

ADO dBase connection String.

Posted on 2000-04-10
7
762 Views
Last Modified: 2013-12-20
Hi,
   I'm using ADO in a .asp script and I'm trying to display a dBase workbook.

I'm using the line:
filePath = Server.MapPath("serial.dbf")
      
Set oConn = Server.CreateObject"ADODB.Connection")

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
                  
and I get the error:

Error Type:
Microsoft JET Database Engine (0x80004005)
Unrecognized database format 'c:\inetpub\scripts\serial.DBF'.
/scripts/SimpleQuery_VBScript.asp, line 37

I know it's because I'm using the wrong connect string, but which one should I be using?
0
Comment
Question by:cide
  • 3
  • 2
  • 2
7 Comments
 

Author Comment

by:cide
ID: 2702672
Actually I got that to work I just have a problem with the correct SQL string I get this error:

Error Type:
Microsoft OLE DB Provider for Indexing Service (0x80040E14)
View 'SERIAL' has not been defined in catalog 'c:\inetpub\scripts\serial.dbf'. SQLSTATE=42S02
/scripts/SimpleQuery_VBScript.asp, line 43

when using:
Set oRs = oConn.Execute("SELECT * From serial")

Thanks in Advance.
0
 
LVL 4

Expert Comment

by:gcs001
ID: 2702750
What does your connection string look like?  Have you specified an Initial Catalog?
0
 

Author Comment

by:cide
ID: 2702779
oConn.Open "Provider=MSIDSX.1;Data Source=" & filePath
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 4

Expert Comment

by:gcs001
ID: 2702943
Have you tried specifying the Initial Catalog on the connection?
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2703672
When connecting to dBase files, your connection string look like this: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\apps\office\;Extended Properties="dBase IV;";Persist Security Info=False

Note that the "Data Source" parameter is giving only the path to the DBF file. The DBF file will be specified in your recordset query.
0
 

Author Comment

by:cide
ID: 2705190
How would I write the recordset query then?  You have to have an example?

my db is called serial.dbf
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 50 total points
ID: 2705244
In this sample, «Clients» is my dbase file:

Private mcn As ADODB.Connection
Private mrst As ADODB.Recordset

Private Sub Command1_Click()
    mrst.MoveNext
    Text1.Text = mrst.Fields(0)
End Sub

Private Sub Command2_Click()
    mrst.MovePrevious
    Text1.Text = mrst.Fields(0)
End Sub

Private Sub Form_Load()
    Set mcn = New ADODB.Connection
    mcn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\apps\office\;Extended Properties='dBase IV;';Persist Security Info=False"
    mcn.Open
   
    Set mrst = New ADODB.Recordset
    mrst.Open "SELECT * FROM Clients", mcn, adOpenStatic, adLockReadOnly
    Text1.Text = mrst.Fields(0)
End Sub
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

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 …
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 …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

20 Experts available now in Live!

Get 1:1 Help Now