Creation d'une base de donnée en mode dynamique

Résolu
andregoub Messages postés 83 Date d'inscription vendredi 25 juin 2004 Statut Membre Dernière intervention 19 mai 2011 - 27 juil. 2010 à 18:43
andregoub Messages postés 83 Date d'inscription vendredi 25 juin 2004 Statut Membre Dernière intervention 19 mai 2011 - 27 juil. 2010 à 19:08
bonjour

je voudrai créer une base de donnée en mode dynamique sous delphi 2010 avec interbase

[b]J'ai une erreur indiqué Contact ne contient pas un membre nommé createbase
ça veut dire quoi exactement et comment remédier à cette erreur/b

voici le code
unit contact;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Grids, DBGrids, Mask, DBCtrls, DB, IBDatabase,
IBCustomDataSet, IBQuery;

type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit9: TDBEdit;
DBGrid1: TDBGrid;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
IBDatabase1: TIBDatabase;
IBQuery1: TIBQuery;
IBTransaction1: TIBTransaction;
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TMain. CreateDatabase (ADBFileName: TFilename);
var
IBDataBase: TIBDatabase;
IBQuery: TIBQuery;
IBTransaction: TIBTransaction;
begin
IBDataBase : = TIBDatabase.Create(nil);
IBQuery := TIBQuery.Create(nil);
IBTransaction := TIBTransaction.Create(nil);
try
IBDataBase.DatabaseName := ADBFileName;
IBDataBase.SQLDialect := 3;
IBDataBase.Params.Clear;
IBDataBase.Params.Add('USER "SYSDBA"');
IBDataBase.Params.Add('PASSWORD "masterkey"');
IBDataBase.Params.Add('PAGE_SIZE 4096');
IBDataBase.CreateDatabase;
IBDatabase.Connected := true;
IBTransaction.DefaultDatabase := IBDataBase;
IBQuery.Database := IBDatabase;
IBQuery.Transaction := IBTransaction;
try
IBQuery.SQL.Add('create table IODescriptorEx(IOId int not null,IOFileMask VarChar(30),'+
'AlternativeDesc VarChar(50));');
IBQuery.ExecSQL;
{...}
{ Reste de la création de la base par script SQL en dur ou récupérer dans un fichier }
{...}
IBTransaction.Commit;
except
IBTransaction.Rollback;
end;
IBDataBase.Connected := false;
finally
FreeAndNil(IBQuery);
FreeAndNil(IBTransaction);
FreeAndNil(IBDataBase);
end;
end;
end.

merci de m'aider

dédé

2 réponses

andregoub Messages postés 83 Date d'inscription vendredi 25 juin 2004 Statut Membre Dernière intervention 19 mai 2011 1
27 juil. 2010 à 19:08
merci

dédé
3
Cirec Messages postés 3833 Date d'inscription vendredi 23 juillet 2004 Statut Modérateur Dernière intervention 18 septembre 2022 50
27 juil. 2010 à 18:59
Salut,

essayes déjà en modifiant le code comme suit:
[hr]{...}

  [b]private
    /b{ Déclarations privées }
  [b]public
    /b{ Déclarations publiques }
    procedure CreateDatabase(ADBFileName: TFilename);
  end;

[b]var
/bForm1: TForm1;

[b]implementation

/b{$R *.dfm}

procedure TForm1.CreateDatabase(ADBFileName: TFilename);
[b]var
/b{...}
[hr]
ça devrait résoudre ce problème

[hr]@+Cirec
[hr]
1
Rejoignez-nous