was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

40 Visitors Online


 
...eine DBExpress-Verbindung zur Laufzeit erstellen?
Autor: Max Kleiner
Homepage: http://max.kleiner.com
[ Tip ausdrucken ]  

Tip Bewertung (20):  
     


{
  The normal way for Delphi and Kylix is just to check dbExpress,
  put a TSQLConnection on a form then double-click the TSQLConnection to display
  the Connection Editor and set parameter values (database path, connection name etc.)
  to indicate the settings.

  But in our example, all goes by runtime (path and login) with dbExpress we don't need
  an alias or the BDE either.
}

procedure TVCLScanner.PostUser(const Email, FirstName, LastName: WideString);
var
  
Connection: TSQLConnection;
  DataSet: TSQLDataSet;
begin
  
Connection := TSQLConnection.Create(nil);
  with Connection do
  begin
    
ConnectionName := 'VCLScanner';
    DriverName := 'INTERBASE';
    LibraryName := 'dbexpint.dll';
    VendorLib := 'GDS32.DLL';
    GetDriverFunc := 'getSQLDriverINTERBASE';
    Params.Add('User_Name=SYSDBA');
    Params.Add('Password=masterkey');
    Params.Add('Database=milo2:D:\frank\webservices\umlbank.gdb');
    LoginPrompt := False;
    Open;
  end;
  DataSet := TSQLDataSet.Create(nil);
  with DataSet do
  begin
    
SQLConnection := Connection;
    CommandText := Format('INSERT INTO kings VALUES("%s","%s","%s")',
      [Email, FirstN, LastN]);
    try
      
ExecSQL;
    except
    end
;
  end;
  Connection.Close;
  DataSet.Free;
  Connection.Free;
end;

 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


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