Hi All,
I made one simple app one datamodule one frommain and plus one fromCad When I execute app I have received the following message from error, when I try to open a TZQuery in the related FromCad this this with datamodule and in the event oncreate of the date modulates placed TZConnection.Connect, and see for the Firebird Guardian of the Firebird that the connection this established with bank but I finish receiving this message from error Database Connection component is not assigned
Debtor
Edmilson
error Database Connection component is not assigned
Moderators: gto, cipto_kh, EgonHugeist
Hi, Michael
Thanks for ask.
I want move my reports generation to zeos. (http://scribes.ipnetwork.eti.br)
FormCad, Tzquery or TZTable objects are created in runtime.But the connection object aren´t created in run-time.
I have this app write with IBO and BDE objects and I have not problems.
Regards!
Edmilson
DataModule:
[syntax="delphi"]procedure TFormDados.DataModuleCreate(Sender: TObject);
var PrinterName : String;
var i,J : Integer;
var NewFileName : String;
var
Drivers: IZCollection;
Driver: IZDriver;
Protocols: TStringDynArray;
begin
With TfrmLogin.create(nil) do
begin
List.Clear;
Protocols := nil; //
Drivers := DriverManager.GetDrivers;
for I := 0 to Drivers.Count - 1 do
begin
Driver := Drivers as IZDriver;
Protocols := Driver.GetSupportedProtocols;
for J := Low(Protocols) to High(Protocols) do
List.Items.add(Protocols[J]);
end;
ShowModal;
FormDados.BDataBase.HostName := edtHost.text;
FormDados.BDataBase.Protocol := List.Text;
FormDados.BDataBase.Database := edtDatabase.Text;
FormDados.BDataBase.User := edtLogin.Text;
FormDados.BDataBase.Password := edtPassword.Text;
Free;
end;
FormDados.BDatabase.Connect;
end;
//-------end DataModule Codigo [/syntax]
Main APP
[syntax="delphi"]procedure TFormProjeto.BFormaNovaClick(Sender: TObject);
begin
FormaNova;
end;
procedure TFormProjeto.FormaNova;
var
I: Integer;
begin
if DestroiForma = False then
Exit;
// Nome
DefineMostraNome('');
// Cria Formulário
FormForma := TFormForma.Create(Application);
FormForma.Left := FormProjeto.Left + (FormProjeto.PSuporte.Width * 3) + 8;
FormForma.Top := FormProjeto.Top + (FormProjeto.Height) + 6;
//@@ Remove Componenetes já Existentes
{ for I := FormForma.ComponentCount - 1 downto 0 do
FormForma.Components.Free
aqui edmilson;}
FormForma.Show;
// Configura RTDesigner
RTDesigner.BaseControl := FormForma;
RTDesigner.EditMode := True;
end;
//-----End Main[/syntax]
FORMcad
[syntax="delphi"]unit UForma;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
RTDesign, Menus, StdCtrls, Db, ZAbstractRODataset, Grids, DBGrids, Buttons,
ComCtrls, ExtCtrls, DBCtrls, Chart, DBChart,TeeProcs, TeEngine, Series,
IB_Components, DBClient, IB_Session,RLReport, RLBarcode, RLParser,
RLRichText,RLHTMLFilter, RLRichFilter, RLFilters, RLPDFFilter, RLDraftFilter,
atScript, atPascal, FormScript, atMemoInterface, AdvMemo, atBasic,
atScriptDebug, ZAbstractDataset, ZAbstractTable, ZDataset, Mask,
ZConnection;
type
TFormForma = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
FConnection : TZConnection;
MovimentandoJanela: Boolean;
PosicaoEsquerdaJanela, PosicaoTopoJanela: Integer;
procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;
public
gCodigoUsuario, gCodigoDivisao: Integer;
gNomeUsuario: ShortString;
{ Public declarations }
FormaAlterado: Boolean;
function Finaliza: Boolean;
function InicializaExecucao: Boolean;
procedure FinalizaExecucao;
end;
var
FormForma: TFormForma;
implementation
uses UProjeto,SourceEdit,UArquivos,UDados,UConstantes,UPropriedades,ap_DB;
{$R *.DFM}
function TFormForma.InicializaExecucao: Boolean;
begin
Result := False;
try
SalvaPropriedades(Self);
if QueryExecutaTodos(Self,FormProjeto.gFormatoBaseDados) = False then
Exit;
if ArquivoAbreTodos(Self,FormProjeto.gFormatoBaseDados) = False then
Exit;
Result := True;
finally
if Result = False then
RestauraPropriedades(Self);
end;
end;
procedure TFormForma.FinalizaExecucao;
begin
ArquivoFechaTodos(Self);
RestauraPropriedades(Self);
end;
procedure TFormForma.WMNCHitTest(var M: TWMNCHitTest);
begin
inherited;
if M.Result = htCaption then
begin
if MovimentandoJanela = False then
begin
PosicaoEsquerdaJanela := Left;
PosicaoTopoJanela := Top;
end;
MovimentandoJanela := True;
end
else
begin
if MovimentandoJanela = True then
begin
if FormProjeto.RTDesigner.EditMode = True then
begin
if (PosicaoEsquerdaJanela <> Left) or
(PosicaoTopoJanela <> Top) then
begin
FormProjeto.RTDesigner.SelectNone;
FormPropriedades.SelecionaComponente(Self.Name,True);
end;
end;
MovimentandoJanela := False;
end;
end;
end;
function TFormForma.Finaliza: Boolean;
begin
Result := True;
end;
procedure TFormForma.FormCreate(Sender: TObject);
begin
FormaAlterado := False;
MovimentandoJanela := False;
{ FConnection := TZConnection.Create(self);
if FormDados.BDatabase.Connected = False then
FormDados.BDatabase.Connect;
FConnection := FormDados.BDatabase;
if Assigned(FConnection) then
ShowMessage ('ddd');
FConnection.Connect;}
end;
procedure TFormForma.FormResize(Sender: TObject);
begin
// FormForma.Refresh;
if FormProjeto.RTDesigner.EditMode = True then
FormPropriedades.SelecionaComponente(Self.Name,True);
end;
procedure TFormForma.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if FormProjeto.RTDesigner.EditMode = True then
begin
// Copia
if (ssCtrl in Shift) and
(Key = Ord('C')) then
FormProjeto.ComponentesCopia
else
// Cola
if (ssCtrl in Shift) and
(Key = Ord('V')) then
FormProjeto.ComponentesCola
else
// Remve
if Key = VK_DELETE then
FormProjeto.MRemoverComponentes.Click;
end;
end;
procedure TFormForma.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FinalizaExecucao;
end;
procedure TFormForma.FormShow(Sender: TObject);
begin
//---variaveis regservadas 03/07/2005
//---variaveis regservadas 03/07/2005
{ LgCodigoUsuario.Caption := IntToStr(FormPrincipal.gCodigoUsuario);
LgCodigoDivisao.Caption := IntToStr(FormPrincipal.gCodigoDivisao);
LgNomeUsuario.Caption := FormPrincipal.gNomeUsuario;}
///ShowMessage (gNomeUsuario);
///FormDados.BDatabase.Connect;
end;
end.[/syntax]
Thanks for ask.
I want move my reports generation to zeos. (http://scribes.ipnetwork.eti.br)
FormCad, Tzquery or TZTable objects are created in runtime.But the connection object aren´t created in run-time.
I have this app write with IBO and BDE objects and I have not problems.
Regards!
Edmilson
DataModule:
[syntax="delphi"]procedure TFormDados.DataModuleCreate(Sender: TObject);
var PrinterName : String;
var i,J : Integer;
var NewFileName : String;
var
Drivers: IZCollection;
Driver: IZDriver;
Protocols: TStringDynArray;
begin
With TfrmLogin.create(nil) do
begin
List.Clear;
Protocols := nil; //
Drivers := DriverManager.GetDrivers;
for I := 0 to Drivers.Count - 1 do
begin
Driver := Drivers as IZDriver;
Protocols := Driver.GetSupportedProtocols;
for J := Low(Protocols) to High(Protocols) do
List.Items.add(Protocols[J]);
end;
ShowModal;
FormDados.BDataBase.HostName := edtHost.text;
FormDados.BDataBase.Protocol := List.Text;
FormDados.BDataBase.Database := edtDatabase.Text;
FormDados.BDataBase.User := edtLogin.Text;
FormDados.BDataBase.Password := edtPassword.Text;
Free;
end;
FormDados.BDatabase.Connect;
end;
//-------end DataModule Codigo [/syntax]
Main APP
[syntax="delphi"]procedure TFormProjeto.BFormaNovaClick(Sender: TObject);
begin
FormaNova;
end;
procedure TFormProjeto.FormaNova;
var
I: Integer;
begin
if DestroiForma = False then
Exit;
// Nome
DefineMostraNome('');
// Cria Formulário
FormForma := TFormForma.Create(Application);
FormForma.Left := FormProjeto.Left + (FormProjeto.PSuporte.Width * 3) + 8;
FormForma.Top := FormProjeto.Top + (FormProjeto.Height) + 6;
//@@ Remove Componenetes já Existentes
{ for I := FormForma.ComponentCount - 1 downto 0 do
FormForma.Components.Free
aqui edmilson;}
FormForma.Show;
// Configura RTDesigner
RTDesigner.BaseControl := FormForma;
RTDesigner.EditMode := True;
end;
//-----End Main[/syntax]
FORMcad
[syntax="delphi"]unit UForma;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
RTDesign, Menus, StdCtrls, Db, ZAbstractRODataset, Grids, DBGrids, Buttons,
ComCtrls, ExtCtrls, DBCtrls, Chart, DBChart,TeeProcs, TeEngine, Series,
IB_Components, DBClient, IB_Session,RLReport, RLBarcode, RLParser,
RLRichText,RLHTMLFilter, RLRichFilter, RLFilters, RLPDFFilter, RLDraftFilter,
atScript, atPascal, FormScript, atMemoInterface, AdvMemo, atBasic,
atScriptDebug, ZAbstractDataset, ZAbstractTable, ZDataset, Mask,
ZConnection;
type
TFormForma = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
FConnection : TZConnection;
MovimentandoJanela: Boolean;
PosicaoEsquerdaJanela, PosicaoTopoJanela: Integer;
procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;
public
gCodigoUsuario, gCodigoDivisao: Integer;
gNomeUsuario: ShortString;
{ Public declarations }
FormaAlterado: Boolean;
function Finaliza: Boolean;
function InicializaExecucao: Boolean;
procedure FinalizaExecucao;
end;
var
FormForma: TFormForma;
implementation
uses UProjeto,SourceEdit,UArquivos,UDados,UConstantes,UPropriedades,ap_DB;
{$R *.DFM}
function TFormForma.InicializaExecucao: Boolean;
begin
Result := False;
try
SalvaPropriedades(Self);
if QueryExecutaTodos(Self,FormProjeto.gFormatoBaseDados) = False then
Exit;
if ArquivoAbreTodos(Self,FormProjeto.gFormatoBaseDados) = False then
Exit;
Result := True;
finally
if Result = False then
RestauraPropriedades(Self);
end;
end;
procedure TFormForma.FinalizaExecucao;
begin
ArquivoFechaTodos(Self);
RestauraPropriedades(Self);
end;
procedure TFormForma.WMNCHitTest(var M: TWMNCHitTest);
begin
inherited;
if M.Result = htCaption then
begin
if MovimentandoJanela = False then
begin
PosicaoEsquerdaJanela := Left;
PosicaoTopoJanela := Top;
end;
MovimentandoJanela := True;
end
else
begin
if MovimentandoJanela = True then
begin
if FormProjeto.RTDesigner.EditMode = True then
begin
if (PosicaoEsquerdaJanela <> Left) or
(PosicaoTopoJanela <> Top) then
begin
FormProjeto.RTDesigner.SelectNone;
FormPropriedades.SelecionaComponente(Self.Name,True);
end;
end;
MovimentandoJanela := False;
end;
end;
end;
function TFormForma.Finaliza: Boolean;
begin
Result := True;
end;
procedure TFormForma.FormCreate(Sender: TObject);
begin
FormaAlterado := False;
MovimentandoJanela := False;
{ FConnection := TZConnection.Create(self);
if FormDados.BDatabase.Connected = False then
FormDados.BDatabase.Connect;
FConnection := FormDados.BDatabase;
if Assigned(FConnection) then
ShowMessage ('ddd');
FConnection.Connect;}
end;
procedure TFormForma.FormResize(Sender: TObject);
begin
// FormForma.Refresh;
if FormProjeto.RTDesigner.EditMode = True then
FormPropriedades.SelecionaComponente(Self.Name,True);
end;
procedure TFormForma.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if FormProjeto.RTDesigner.EditMode = True then
begin
// Copia
if (ssCtrl in Shift) and
(Key = Ord('C')) then
FormProjeto.ComponentesCopia
else
// Cola
if (ssCtrl in Shift) and
(Key = Ord('V')) then
FormProjeto.ComponentesCola
else
// Remve
if Key = VK_DELETE then
FormProjeto.MRemoverComponentes.Click;
end;
end;
procedure TFormForma.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FinalizaExecucao;
end;
procedure TFormForma.FormShow(Sender: TObject);
begin
//---variaveis regservadas 03/07/2005
//---variaveis regservadas 03/07/2005
{ LgCodigoUsuario.Caption := IntToStr(FormPrincipal.gCodigoUsuario);
LgCodigoDivisao.Caption := IntToStr(FormPrincipal.gCodigoDivisao);
LgNomeUsuario.Caption := FormPrincipal.gNomeUsuario;}
///ShowMessage (gNomeUsuario);
///FormDados.BDatabase.Connect;
end;
end.[/syntax]
Hi orlando,
don't be angry, but highlighted your code to make it better to look at . Please take a short look at the added code. Hope this will be helpful ...
Btw: Scribes seems to be a pretty cool piece of work . Never heard of it, before. I'm alwas looking for free software solutions Have to check it out!
Regards!
don't be angry, but highlighted your code to make it better to look at . Please take a short look at the added code. Hope this will be helpful ...
Btw: Scribes seems to be a pretty cool piece of work . Never heard of it, before. I'm alwas looking for free software solutions Have to check it out!
Regards!
You do not have the required permissions to view the files attached to this post.
Hi Michael
Excuse for not having placed the code with a better vizual, and that I still do not know very well the edition tool of code of the forum.
Very obliged, now it gave certain seeing its small code I discovered what it was making of missed
Btw: Debtor for the commentaries on the Scribes, I want to move it I stop a solution of opened code, therefore I have will to also open the code of it, this version that this in the InterNet and a well old version of software, the new version that I am working now this well improved. Thus that I already will have moved for the ZEOS would inform here in the forum for that to want to know mine app. Another thing you would have one soon of the ZEOS I to place in app. with the credits.
Regards!
Edmilson Orlando de Oliveira
Excuse for not having placed the code with a better vizual, and that I still do not know very well the edition tool of code of the forum.
Very obliged, now it gave certain seeing its small code I discovered what it was making of missed
Btw: Debtor for the commentaries on the Scribes, I want to move it I stop a solution of opened code, therefore I have will to also open the code of it, this version that this in the InterNet and a well old version of software, the new version that I am working now this well improved. Thus that I already will have moved for the ZEOS would inform here in the forum for that to want to know mine app. Another thing you would have one soon of the ZEOS I to place in app. with the credits.
Regards!
Edmilson Orlando de Oliveira
Hi Edmilson,
Regrads!
P.S.: Looking forward towards the future of "scribes"
So, this means that your problem is solved! Am I right? Don't be angry but I have little problems to understand your english...orlando wrote:Very obliged, now it gave certain seeing its small code I discovered what it was making of missed
Regrads!
P.S.: Looking forward towards the future of "scribes"