Solved

database connection

Posted on 1997-05-12
3
184 Views
Last Modified: 2013-11-23
I am trying to access create a Paradox database with an
SQL statement.  I don't want to use any of the database components.  Can I code all of the connection properties and then use the SQL create command?  After I create then I need to access the database with SQL commands.  I can't seem to find anything on this process in any of the supplied Delphi books or in any of the books at my local book store.  Thanks for your help.
0
Comment
Question by:DPomeroy
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
hpierson earned 50 total points
ID: 1336154
Try using the BDE (Borland Database Engine) interface. It is not as easy or straightfoward as using database components, but it should work for you.

From the BDE help file

The Borland Database Engine (BDE) enables access to both local and remote database tables through local SQL (Structure Query Language). Local SQL (sometimes called "client-based SQL") is a subset of ANSI-92 SQL enhanced to support Paradox and dBASE (standard) naming conventions for tables and fields (called "columns" in SQL).
Local SQL lets you use SQL to query "local" standard database tables that do not reside on a database server (specifically Paradox or dBASE tables) as well as "remote" SQL servers. Local SQL is also essential to make multi-table queries across both local standard tables and those on remote SQL servers.
0
 
LVL 3

Expert Comment

by:hpierson
ID: 1336155
Here is an example (again from the BDE Help file)

Create a table on disk by using a given SQL statement.

The filename is also passed as a parameter. The function returns the number of rows in the result table. This example uses the following input:  
      fDbiQExec(hNewCur, 'QUERY.DB', 'SELECT * FROM TEST;');

Function fDbiQExec(hTmpDb: hDBIDB; TblName, SQL: String): Longint;
var
  hStmt: hDBIStmt;
  hQryCur, hNewCur: hDBICur;
  iRecCount: LongInt;
begin
  hQryCur := nil;
  hNewCur := nil;
  hStmt := nil;

  try
    Check(DbiQAlloc(hTmpDb, qrylangSQL, hStmt));
    Check(DbiQPrepare(hStmt, PChar(SQL)));
    Check(DbiQExec(hStmt, @hQryCur));
    Check(DbiQInstantiateAnswer(hStmt, hQryCur, PChar(TblName), szPARADOX,
                                      true, hNewCur));

    Check(DbiGetRecordCount(hNewCur, iRecCount));
    Result := iRecCount;
  finally
    if hStmt <> nil then
      Check(DbiQFree(hStmt));
    if hNewCur <> nil then
      Check(DbiCloseCursor(hNewCur));
  end;
end;
0
 

Author Comment

by:DPomeroy
ID: 1336156
I sure can't find that BDE help file in my system.  I have Delphi 2.0.  I will keep trying.  It seems to me that there should be something written in some book somewhere that would show me how to do this.  It took about 3 minutes for me to figure it out in Visual Basic.  There documentation is so much better than Borlands.  Its a shame.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

15 Experts available now in Live!

Get 1:1 Help Now