Solved

database connection

Posted on 1997-05-12
3
205 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
[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
  • 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

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

696 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