BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

pass params to Tthread?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Sang Tang
Guest





PostPosted: Tue Nov 18, 2003 6:28 am    Post subject: pass params to Tthread? Reply with quote



Hi, I'm writing a Tthread unit for query. I want to pass params when
created(see the coding at the below). but, I've got a error is '
Declaration of 'Create' differs from previous declaration'. Does any know
how to solve or what's the problem in my procedure?

my coding;
public
constructor Create(dm:TDataset; sqlString:String);
end;



Back to top
Paul Nicholls
Guest





PostPosted: Tue Nov 18, 2003 6:30 am    Post subject: Re: pass params to Tthread? Reply with quote



Can you show us the full declaration of your TThread based class?

"Sang Tang" <STang (AT) abcmts (DOT) net> wrote

Quote:
Hi, I'm writing a Tthread unit for query. I want to pass params when
created(see the coding at the below). but, I've got a error is '
Declaration of 'Create' differs from previous declaration'. Does any know
how to solve or what's the problem in my procedure?

my coding;
public
constructor Create(dm:TDataset; sqlString:String);
end;






Back to top
Sang Tang
Guest





PostPosted: Tue Nov 18, 2003 8:40 am    Post subject: Re: pass params to Tthread? Reply with quote



Hi Paul, thank you for reply. here is my code. I want to open a query and
insert record to a memTable.
====
interface

uses
Classes, ADODB, dxmdaset, DB;

type
TADOQueryThread = class(TThread)
private
cnn1 : TADOConnection;
qry1 : TADOQuery;
{ Private declarations }
protected
procedure Execute; override;
public
constructor Create(dm:TdxMemData; sqlString:String);
end;

implementation

{ TADOQueryThread }
procedure TADOQueryThread.Execute;
begin
end;

procedure TADOQueryThread.Create(dm:TdxMemData; sqlString:String);
begin
cnn1 := TADOConnection.Create(nil);
try
cnn1.LoginPrompt := False;
cnn1.ConnectionString := 'Provider=SQLOLEDB.1;Password=;Persist
Security Info=True;User ID=sa;Initial Catalog=demo;Data Source=demo';
cnn1.Connected := True;

qry1 := TADOQuery.Create(nil);
try
with qry1 do
begin
Connection := cnn1;
SQL.Text := sqlString;
Open;
while not eof do
begin
dm.InsertRecord([qry1.RecNo,fields[0].asstring]);
next;
end;
end;
finally
qry1.Free;
end;
finally
cnn1.Connected := False;
cnn1.Free;
end;
//
FreeOnTerminate := True;
inherited Create(False);
end;



"Paul Nicholls" <paul-nicholls (AT) hotmail (DOT) com> wrote

Quote:
Can you show us the full declaration of your TThread based class?

"Sang Tang" <STang (AT) abcmts (DOT) net> wrote in message
news:3fb9bb6c (AT) newsgroups (DOT) borland.com...
Hi, I'm writing a Tthread unit for query. I want to pass params when
created(see the coding at the below). but, I've got a error is '
Declaration of 'Create' differs from previous declaration'. Does any
know
how to solve or what's the problem in my procedure?

my coding;
public
constructor Create(dm:TDataset; sqlString:String);
end;








Back to top
Maris Janis Vasilevskis
Guest





PostPosted: Tue Nov 18, 2003 5:25 pm    Post subject: Re: pass params to Tthread? Reply with quote

The best way to avoid errors - use "Complete class".
You have contructor in interface, but procedure in implementation.

Mahris

Sang Tang wrote:
Quote:
====
interface
type
TADOQueryThread = class(TThread)
public
constructor Create(dm:TdxMemData; sqlString:String);
end;

implementation

procedure TADOQueryThread.Create(dm:TdxMemData; sqlString:String);


Back to top
Sang Tang
Guest





PostPosted: Wed Nov 19, 2003 2:45 am    Post subject: Re: pass params to Tthread? Reply with quote

thanks Maris

"Maris Janis Vasilevskis" <mahris (AT) myself (DOT) com> wrote

Quote:
The best way to avoid errors - use "Complete class".
You have contructor in interface, but procedure in implementation.

Mahris

Sang Tang wrote:
====
interface
type
TADOQueryThread = class(TThread)
public
constructor Create(dm:TdxMemData; sqlString:String);
end;

implementation

procedure TADOQueryThread.Create(dm:TdxMemData; sqlString:String);




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.