Solved

ADO dBase connection String.

Posted on 2000-04-10
7
765 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 …
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
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…

863 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

27 Experts available now in Live!

Get 1:1 Help Now