error Database Connection component is not assigned

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
orlando
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 20.11.2005, 01:20
Location: São Paulo / SP
Contact:

error Database Connection component is not assigned

Post by orlando »

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
Michael
ZeosLib's Handyman :o)
ZeosLib's Handyman :o)
Posts: 189
Joined: 15.08.2005, 16:08
Location: Wehrheim
Contact:

Post by Michael »

Hi orlando,

:shock:

could you please be so kind and add the code of your app? This will make everything clearer. Because I have an idea what it could be don't know exactly if I'm right ...

Regards!
:prog2: Use the source, dude!

[align=right]..::.. ZeosLib on SourceForge ..::..[/align]
orlando
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 20.11.2005, 01:20
Location: São Paulo / SP
Contact:

Post by orlando »

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]
Michael
ZeosLib's Handyman :o)
ZeosLib's Handyman :o)
Posts: 189
Joined: 15.08.2005, 16:08
Location: Wehrheim
Contact:

Post by Michael »

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 :up:. Never heard of it, before. I'm alwas looking for free software solutions :c8l: Have to check it out!

Regards!
You do not have the required permissions to view the files attached to this post.
:prog2: Use the source, dude!

[align=right]..::.. ZeosLib on SourceForge ..::..[/align]
orlando
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 20.11.2005, 01:20
Location: São Paulo / SP
Contact:

Post by orlando »

Hi Michael

:oops: 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 :D

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
Michael
ZeosLib's Handyman :o)
ZeosLib's Handyman :o)
Posts: 189
Joined: 15.08.2005, 16:08
Location: Wehrheim
Contact:

Post by Michael »

Hi Edmilson,
orlando wrote:Very obliged, now it gave certain seeing its small code I discovered what it was making of missed :D
So, this means that your problem is solved! Am I right? Don't be angry but I have little problems to understand your english... :oops:

Regrads!

P.S.: Looking forward towards the future of "scribes" :mrgreen:
:prog2: Use the source, dude!

[align=right]..::.. ZeosLib on SourceForge ..::..[/align]
orlando
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 20.11.2005, 01:20
Location: São Paulo / SP
Contact:

Post by orlando »

Hi, Michael

:D Yes, I solved my problem.

:oops: I'am sorry my english is very poor


Thanks

Edmilson
Post Reply