Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Object was open error

51 views
Skip to first unread message

Simon Bowyer

unread,
May 17, 2002, 11:46:33 AM5/17/02
to
I have just started writing an application in D5 pro linking to SQL 2000. So
far it has been a rather trying experiance to say the least! I keep getting
the object was open error when I open certain queries. The error disappears
after 2 attempts and everything then appears to work.

The SQL statement in the TADOQuery is select * from qryEquipment where
EquipmentId = :EquipmentId. The query is not opened in the forms create
event but as a result of double clicking a row on a grid using the following
code:

try
frmEquipment := TfrmEquipment.Create(Application);

frmEquipment.qryMainTable.Parameters.ParamByName('EquipmentId').Value :=

grdEnquiry.DataSource.DataSet.FieldByName('EquipmentId').AsInteger;
frmEquipment.qryMainTable.Prepared := true;
frmEquipment.OpenTables;
frmEquipment.Show;
except
frmEquipment.Destroy;
frmEquipment := nil;
end;

The OpenTables method opens the offending table and the related detail
tables (all TADOQuery components). The following properties are set on the
TADOQuery

CursorLocation=clUseClient
CursorType=ctKeySet
LockType=ltOptimistic
Prepared=false

Why does this error occur? In the past my apps have always used TADOTable
linking to Access 2000 but I read on one of the newsgroups that TADOQuery
was faster and should be used for SQL. Is this true? What is considered best
practice for access to SQL? I am using data aware components on most of the
forms. Does anyone know of any tutorials on the web or can recommend a book
for Delphi to SQL? I already have the MCSE book on SQL design and
implementation.

Thanks for any help

Simon


Simon Bowyer

unread,
May 17, 2002, 12:22:57 PM5/17/02
to
Doing some further testing. The error happens after exiting the OnCalc event
for the table where it succesfully sets the calculated field


"Simon Bowyer" <Simon-...@virgin.net> wrote in message
news:3ce525f4$1_1@dnews...

0 new messages