Fandom

Delphi Programming

Create a Paradox table using SQL (Code Snippet)

2,918pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

  • Author: Damian Gorski
{
  Here is a sample how to quickly create a Paradox table
  with some field definied using a SQL language to do so
}

procedure TForm1.Button1Click(Sender: TObject);
begin
  with Query1 do
  begin
    DatabaseName := 'DBDemos';
    with SQL do
    begin
      Clear;
      {
        CREATE TABLE creates a table with the given name in the
        current database

        CREATE TABLE erzeugt eine Tabelle mit einem angegebenen
        Namen in der aktuellen Datenbank
      }
      Add('CREATE TABLE "PDoxTbl.db" (ID AUTOINC,');
      Add('Name CHAR(255),');
      Add('PRIMARY KEY(ID))');
      {
        Call ExecSQL to execute the SQL statement currently
        assigned to the SQL property.

        Mit ExecSQL wird die Anweisung ausgeführt,
        welche aktuell in der Eigenschaft SQL enthalten ist.
      }
      ExecSQL;
      Clear;
      Add('CREATE INDEX ByName ON "PDoxTbl.db" (Name)');
      ExecSQL;
    end;
  end;
end;


Code Snippets
DatabasesFiles and I/OForms/WindowsGraphicsNetworkingMath and AlgorithmsMiscellaneousMultimediaSystemVCL

Also on Fandom

Random Wiki