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" <Simon-...@virgin.net> wrote in message
news:3ce525f4$1_1@dnews...