| View previous topic :: View next topic |
| Author |
Message |
Sang Tang Guest
|
Posted: Tue Nov 18, 2003 6:28 am Post subject: pass params to Tthread? |
|
|
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
|
Posted: Tue Nov 18, 2003 6:30 am Post subject: Re: pass params to Tthread? |
|
|
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
|
Posted: Tue Nov 18, 2003 8:40 am Post subject: Re: pass params to Tthread? |
|
|
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
|
Posted: Tue Nov 18, 2003 5:25 pm Post subject: Re: pass params to Tthread? |
|
|
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
|
Posted: Wed Nov 19, 2003 2:45 am Post subject: Re: pass params to Tthread? |
|
|
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 |
|
 |
|