whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

19 Visitors Online


 
...quickly create a Paradox table using SQL?
Autor: Damian Gorski
[ Print tip ]  

Tip Rating (14):  
     


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

{
  Hier ein Beispiel, wie man schnell eine Paradox Tabelle
  mit einigen definierten Feldern mittels SQL erzeugen kann.
}

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;

{
  As you can see SQL Language is a pretty familiar one.
  If you understand SQL you can do everything with databases, and not only.
}

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners