Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a TDatamodule from within a thread ...

Status
Not open for further replies.

LucieLastic

Programmer
May 9, 2001
1,694
GB
hi

Is it possible to Create,link and use a TDatamodule from a TThread object?

Here's my thread objects create which calls the DM's create.

constructor TFilesThread.CreateThread(Progress : TProgressBar; FileName : string);
begin
inherited Create(True);
Priority := tpNormal;
FreeOnTerminate := True;
Suspended := false;
PB := Progress;
sFileName := FileName;
CoFileObject := nil;
CoFileObject := TCompanyFiles.Create(nil); //a TDatamodule
end;


Trouble is, I get an Abstract error in the datamodule's create method.

This is the DM's create code:-

Constructor TCompanyFiles.Create(Owner : Tcomponent);
begin
inherited;
Database_Thread.DatabaseName := ODBCds;
Database_Thread.Connected := true;
end;


How do I link to the Datamodule? I want a datamodule created for each thread. Do I have to create it programmatically, hope not as I have quite a few TQueries in it?

Thanks for any help
lou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top