Ver Mensaje Individual
  #1  
Antiguo 28-09-2019
botones67 botones67 is offline
Miembro
 
Registrado: may 2003
Posts: 104
Reputación: 0
botones67 cantidad desconocida en este momento
Cool Instanciar datamodule

Hola a todos.
Miren tengo esta unidad donde intento instanciar un datamodule que contiene un Ttable + Provider + Cliendataset todo parece ir bien hasta que intento modificar los datos de cliente, es como si no lo instanciara pero desde el form si veo todos los componentes del datamodule.
En la parte de abajo del código resalto donde da error.
Sabéis que puede ocurrir?
Gracias , un saludo para todos.
Código Delphi [-]
unit entrada;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics, unit1,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Buttons, RzButton, Vcl.StdCtrls,
  RzLabel, Vcl.Mask, RzEdit, FireDAC.Stan.Intf, FireDAC.Stan.Option,
  FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf,
  FireDAC.DApt.Intf, FireDAC.Stan.Async, FireDAC.DApt, Data.DB,
  FireDAC.Comp.DataSet, FireDAC.Comp.Client;

type
  TForm3 = class(TForm)
    RzToolbarButton2: TRzToolbarButton;
    RzToolbarButton1: TRzToolbarButton;
    edit1: TRzEdit;
    RzLabel1: TRzLabel;
    edit2: TRzEdit;
    RzLabel2: TRzLabel;
    procedure RzToolbarButton2Click(Sender: TObject);
    procedure RzToolbarButton1Click(Sender: TObject);
    procedure RzButton1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    public
  var
    dT: Tdatos;
    { Public declarations }
  end;
var
  Form3: TForm3;
implementation

uses
  general, Unit2;

{$R *.dfm}

procedure TForm3.FormCreate(Sender: TObject);
begin
  dT := Tdatos.Create(self);
end;

procedure TForm3.FormDestroy(Sender: TObject);
begin
  dT.Free;
end;

procedure TForm3.RzButton1Click(Sender: TObject);
var
  frm3: TForm3;
begin
  frm3 := TForm3.Create(self);
  try
    frm3.ShowModal
  finally
    FreeAndnil(frm3);
  end;
end;

procedure TForm3.RzToolbarButton1Click(Sender: TObject);
begin
  close;
end;

procedure TForm3.RzToolbarButton2Click(Sender: TObject);
begin

  if inserta then
  begin
    dt.proce.ExecProc; // generador de ID firebird
  [b]  dt.cliente.Append; AQUI DA ERROR ( VER IMAGEN ADJUNTA)
    dt.cliente.FieldByName('id').AsInteger :=
      dt.proce.ParamByName('CODD4').AsInteger;
    dt.cliente.FieldByName('material').asstring := edit1.Text;
    dt.cliente.FieldByName('Suministra').asstring := edit2.Text;
    dt.cliente.Post;
    dt.cliente.ApplyUpdates(-1);
    dt.Conexion.Commit;
    close;
  end;
  if edita then
  begin
    dT.cliente.edit; AQUI DA ERROR  ( VER IMAGEN ADJUNTA).
    dT.cliente.FieldByName('material').asstring := edit1.Text;
    dT.cliente.FieldByName('suministra').asstring := edit2.Text;
    dT.cliente.Post;
    dT.cliente.ApplyUpdates(-1);
    dT.Conexion.Commit;
    close;
  end;
end;

end.
Imágenes Adjuntas
Tipo de Archivo: jpg ERROR.jpg (30,8 KB, 19 visitas)
Responder Con Cita