Solved

Using external database

Posted on 1998-01-25
3
349 Views
Last Modified: 2012-05-04
I have read some Visual Basic database. It refer that I need to create another file for calling driver of that external database in vb.ini or applicationname.ini as following
   
[Installable ISAMs]
Foxpro2.0=c:\windows\system\xbs100.dll

And use SetDataAccessOption command in application. Suppose my application is Mike.exe . Then,

SetDataAccessOption DB_OPTIONINIPATH, "c:\Mike.ini"

Then, I have to create another file which keep index filename information which is tablename.inf.

Do I need to do all of the above for using external database?
0
Comment
Question by:Mcblake
[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 Comments
 

Expert Comment

by:shachtak
ID: 1453484
This is what you have to do if you want to use the external database's own driver. this also means you have to learn the
database's specific access functions.
my suggestion to you is to use the Open DataBase Connectivity standard (ODBC) which allows you to access every database that supports ODBC (most of them does) in a DAO-like manner which means you can declare and use the database and recordset objects  as if you were using a Jet engine. for more details refer to Visual Basic documentation on the subject.
0
 

Author Comment

by:Mcblake
ID: 1453485
To: shachtak
So, How can I use ODBC in my application using VB4.0? If I use ODBC, I don't need to do whatever in my question,right?

0
 

Accepted Solution

by:
dpms earned 30 total points
ID: 1453486
Since there are a lot of people who don't know how to connect via ODBC you can still just "go with what you know" and use the ISAM driver to connect. So, covering the issues of your question - it goes something like this...

#1. If connecting to the database is all you want to do. You don't need to make a separate file that will keep track of index issues or call the driver. So don't worry about that.

#2. SetDataAccessOption is only need if the ini file does not have the same name as your appname or is not located in the windows folder. If the appname and appini name are the same and the file is in the windows folder - you don't even need   SetDataAccessOption in your code (Now isn't this easier than you thought).

#3. keep in mind, while your in the programming environment - vb is running off of the vb.ini file which already has an ISAM section. You can just copy and paste this section into your app.ini file so all that work is already done for you (even easier still.

#4. Here's is an example of a program I wrote that connects to dBase III. Keep in mind that you have to change it to connect to Foxpro if that's what you want to do. (Consult the external.txt if you need examples). In this code I did use   SetDataAccessOption because I was using another appini file that did not share the name of my program. I could have just renamed it and not used SetDataAccessOption. (also, keep in mind...  SetDataAccessOption is used in VB3. In VB4 you cannot use this command - it is outdated. The DBEngine object must be used. Also... some databases use the actual file as the DatabaseName some use the folder that holds it. Very Important!! I believe that foxpro is the latter.

Code example:

Sub DBConnect ()
Dim MyDB As database
Dim myTable As table
Dim Response As String

Title = "dBASE Viewer"
Msg = "Database path name?"

SetDataAccessOption 1, "c:\windows\append.ini"
Response = InputBox(Msg, Title)
data1.DatabaseName = Response
data1.RecordSource = "EEInfo"
data1.Connect = "dBASE III;"

Set MyDB = OpenDatabase(Response, 0, 0, "dBASE III;")
Set myTable = MyDB.OpenTable("Tickets")
End Sub

   

             
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

623 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