Jump to content

Conexão formulário "DataModule"


Recommended Posts

Carlos230360

Bom dia, sou novo em programação Lazarus, e estou iniciando um projeto para controle de estoque, ocorre que preciso usar um datamodule, o problema é que quando estou fazendo a ligação na fase de programação tudo ocorre muito bem, só quando faço a compilação, nesta fase surgi o seguinte erro " "unit UniDados not used in FormPrincipal” ", e no executável a conexão com o banco some, segue código abaixo, agradeço qualquer ajuda, obrigado:

Form principal:

<

unit FormPrincipal;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, DBCtrls, DBGrids;

type

  { TForm1 }

  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    DBNavigator1: TDBNavigator;
    procedure teste(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

uses UniDados;

{ TForm1 }

procedure TForm1.teste(Sender: TObject);
begin
//  DataModule1.Create(self);
end;

end. 

>

Form DataModule:

<

unit UniDados;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, ZConnection, ZDataset, DB;

type

  { TDataModule1 }

  TDataModule1 = class(TDataModule)
    DataSource1: TDataSource;
    ZConnection1: TZConnection;
    ZQuery1: TZQuery;
  private

  public

  end;

var
  DataModule1: TDataModule1;

implementation

{$R *.lfm}

end.

>

Edited by thoga31
GeSHi
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.