Solved

ADO dBase connection String.

Posted on 2000-04-10
7
767 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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

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

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 …
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
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…

749 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