Solved

ADO dBase connection String.

Posted on 2000-04-10
7
769 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
[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
 

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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 4

Expert Comment

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

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 70

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Suggested Courses

635 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