Re:Data access components in a DLL
Richard ,
I presume you are creating your objects on-the-fly rather than using a
form.
In general, it's a matter of creating the components correctly, if not
created properly, you generally get memory access violations because
uninitialized pointers are used.
I know this sound glib, but your question certainly lacks detail.
For example, to create TTables and DataSources (this is a snippet from
working DLL code):
var
Customer:TTable;
Price:TTable;
PriceDS:TDataSource;
Price2DS:TDataSource;
ProductDS:TDataSource;
Product2DS:TDataSource;
procedure OpenTables;
begin
try
PriceDS:=TDataSource.Create(nil);
Price2DS:=TDataSource.Create(nil);
ProductDS:=TDataSource.Create(nil);
Product2DS:=TDataSource.Create(nil);
Customer := TTable.Create(Nil);
Customer.DatabaseName:=TableDir;
Customer.TableName:=TableName1;
Customer.active:=true;
Price := TTable.Create(Nil);
Price.DatabaseName:=TableDir;
Price.TableName:=TableName2;
Price.IndexFieldNames:='Code';
Price.active:=true;
PriceDS.DataSet:=Price;
...
When the DLL closes, you need to destroy the components you create to
recover memory.
--
Paul, (Mon, 10 June 96, 22:10 EST)
SoftStuff, Croydon, Victoria, Australia, 3136
pa...@linuxserver.pccity.com.au
Quote
On Monday, 10 June 1996, Richard MacDonald wrote...
> On 9 Jun 1996 17:01:28 GMT, a...@ix.netcom.com (Adrian Zelazny ) wrote:
> > I need to create dlls with data access components embedded within
> >them. They build without errors, but I get an exception when calling
> >them. Any ideas/components out there?
> >respond to adr...@vhb.com
> >thanks.
> Someone might have an idea if you could tell us what the exception is.
>{*word*106} MacDonald