Re:Accessing database data from a stand-alone unit
To anyone who can help:
I'm an experience VB programmer who is trying to learn Delphi on my own.
I'm currently trying to create a stand-alone unit (i.e. one that is not
connected to a form) that access data from a Paradox table.
I have added a database component to a form in my project and reference
it from the code in my stand-alone unit.
The problem I have is that each time I try to run the program I get an
EGPFault error! I've tried a number of things, including explicitly
calling the .create property for the TTable variable I've created, but I
continue to get the same error.
If I drop a table, source, and dbgrid component on a form and use the same
database and table everything works fine.
I'm sure this is a very basic error, but I'm completely lost. If anyone
can offer any help I'd really appreciate it.
The code I'm using is shown below:
var
bInitialized: boolean;
tblMsg: TTable;
implementation
function MsgCreate(AOwner: TComponent): boolean;
begin
try
try
bInitialized := False;
tblMsg.Create(AOwner);
tblMsg.DatabaseName := 'db';
tblMsg.TableType := ttParadox;
tblMsg.TableName := 'Message.db';
tblMsg.Open;
bInitialized := True;
except
on EGPFault do
ShowMessage('EGPFault error in QMsg.MsgCreate');
on EAbort do
ShowMessage('EAbort error in QMsg.MsgCreate');
on EBreakpoint do
ShowMessage('EBreakpoint error in QMsg.MsgCreate');
on EConvertError do
ShowMessage('EConvertError error in QMsg.MsgCreate');
end;
Thanks!
Rod Gicker
rgic...@worldnet.att.net