Solved

database connection

Posted on 1997-05-12
3
200 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

808 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