Subject Re: [IBO] Thread Error - Bug
Author Vincenzo Scarpellino
Hi,
It don't think it is a problem of connection. I hope Jason W. can explain me so I can understand where is my mistake.

Thank You

----- Original Message -----
From: Hans Hoogstraat
To: IBObjects@yahoogroups.com
Sent: Monday, August 30, 2004 5:03 PM
Subject: Re: [IBO] Thread Error - Bug


I thinm that

After

FConnection.Password:= 'masterkey';

you still have to connect to the server

FConnection.Connect;

and wait for the connection before you continue, else handle some connect
error.

----- Original Message -----
From: "Vincenzo Scarpellino" <vincenzoscarpellino@...>
To: <IBObjects@yahoogroups.com>
Sent: Monday, August 30, 2004 4:30 AM
Subject: [IBO] Thread Error - Bug


|
| FB 1.5 - IBO 4.3.Aa - WIN XP Prof.
|
|
| Hi,
|
| Before my holiday I wrote any messages about to execute a query in
background with TThread Object, but I didn't understand if my problems
depends by a bug or an wrong error using IBObjects. I am converting my BDE
application and I am trying to get the same behavior with run a query in
background. It work fine when I let elapse a little time before to run a new
query: I have a button to run my query (see borland demos in
delphi7\demos\db\BkQuery I am using that sample of course changing reference
objects) when I click without let elapse this time first query hangs and
second work fine. Next there is my code (I tried to use IB_Cursor or
IB_Query with IB_Grid with IB_Datasource but nothing changed). Why doesn't
it work fine ? Is it a bug ?
|
|
| type
| TForm2 = class(TForm)
| DBGrid1: TDBGrid;
| Navigator1: TDBNavigator;
| DSThread: TDataSource;
| private
| { Private declarations }
| public
| { Public declarations }
| end;
|
| var
| Form2: TForm2;
|
| { TEurSecurityThread }
| type
| TEurSecurityThread = class(TThread)
| private
| FSession:TIB_Session;
| FConnection: TIB_Connection;
| FTransaction: TIB_Transaction;
| FQuery: TIBOQuery;
| procedure ConnectQuery;
| protected
| procedure Execute; override;
| public
| constructor Create(QForm:TForm2);
| end;
|
| procedure BackgroundQuery;
|
| implementation
|
| {$R *.dfm}
|
| { BackgroundQuery }
| procedure BackgroundQuery;
| begin
| Form2 := TForm2.Create(Application);
|
| with Form2 do
| begin
| Show;
| end;
|
| TEurSecurityThread.Create(Form2);
| end;
|
| constructor TEurSecurityThread.Create(QForm:TForm2);
| begin
| Form2 := QForm;
| FreeOnTerminate := True;
| inherited Create(False);
| end;
|
| procedure TEurSecurityThread.ConnectQuery;
| begin
| with Form2 do
| begin
| DSThread.DataSet:= FQuery;
| DBGrid1.DataSource:= DSThread;
| Navigator1.DataSource:= DSThread;
|
| WindowState:= wsNormal;
| BringToFront;
| end;
| end;
|
| procedure TEurSecurityThread.Execute;
| begin
| with Form2 do
| try
| try
| if (FSession = nil) then
| begin
| FSession := TIB_Session.Create(nil);
|
| FConnection:= TIB_Connection.Create(FSession);
|
| FConnection.Protocol:= cpTCP_IP;
| FConnection.Server:= '192.168.255.2';
| FConnection.Path:= 'C:\EURARCHI\DATABASE';
| FConnection.SQLDialect:= 3;
| FConnection.Username:= 'SYSDBA';
| FConnection.Password:= 'masterkey';
|
| FTransaction:= TIB_Transaction.Create(FSession);
| FTransaction.IB_Connection:= FConnection;
|
| FQuery:= TIBOQuery.Create(FSession);
| FQuery.IB_Transaction:= FTransaction;
| FQuery.IB_Connection:= FConnection;
|
|
| with FQuery do
| begin
| if not IB_Transaction.Started then
| IB_Transaction.StartTransaction;
|
| FQuery.SQL.Clear;
| FQuery.SQL.Add('SELECT * FROM CLF WHERE EURAZNOME= ''GRP''');
|
| if not Prepared then Prepare;
| Open;
| end;
| end;
|
| Synchronize(ConnectQuery);
| except
| WindowState:= wsNormal;
| end;
| finally
| WindowState:= wsNormal;
| end;
| end;
|
| end.
|
|
|
|
| --
| Email.it, the professional e-mail, gratis per te: http://www.email.it/f
|
| Sponsor:
| Perdi 5 Kg in 30 giorni con American Diet System!
| * La nuova soluzione per dimagrire in modo naturale!
| *
| Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid&27&d0-8
|
| [Non-text portions of this message have been removed]
|
|
|
|
|
___________________________________________________________________________
| IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
| without the need for BDE, ODBC or any other layer.
|
___________________________________________________________________________
| http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
| keyword-searchable FAQ, community code contributions and more !
| Yahoo! Groups Links
|
|
|
|
|
|
|



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !


Yahoo! Groups Sponsor
ADVERTISEMENT





------------------------------------------------------------------------------
Yahoo! Groups Links

a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/IBObjects/

b.. To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Risparmia 80 € con l'Offerta Tavola d'Autore: 18 eccellenti vini Giordano
* + 7 Bontà alimentari + un carrello-dispensa o una batteria di pentole!
*
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid&22&d1-8

[Non-text portions of this message have been removed]