[DUG] Rhino MocksThis may not be the problem, but I have the impression its 
generally cleaner to make sure a dataset is closed before altering either the 
query or parameters or other linkages to data providers etc.  You may wish to 
make sure there is an optional close action as in:

    if  ClientDataSet1.active then ClientDataSet1.close;     <== maybe add this
    ADOQueryEdit.SQL.Text:=’xxxxxxxxx’;
    DataSetProvider1.Dataset:=ADOQueryEdit;
    ClientDataSet1.Providername:=DataSetProvider1;
    ClientDataSet1.FetchParams;
    ClientDataSet1.Open;

(not all of those steps may be needed, but the Fetchparams is needed it the 
parameters in the SQL change as well).  I am guessing the problem is the 
dataset is open when you try to alter the linkages such as trying to connect a 
different query.

John
From: Edward Huang 
Sent: Monday, February 21, 2011 8:54 PM
To: 'NZ Borland Developers Group - Delphi List' 
Subject: [DUG] Object was open

Hi,

I'm having a strange error recently.  We have a program that has been running 
on a Win2003 server for a long time, and suddenly from last week it comes up 
'Object was open' errors.

Typically, the program uses 2 TADOQuery, one will select/Edit/Post, another one 
with an 'Insert into xxx' query, both pointing to a same SQL Server 2005 table. 
 The pattern appears on many places.

Disregard the nicety of the logic, it has been done that way for over 5 years, 
first on Win 2000 server with SQL Server 2000, and later on Win 2003 server 
with SQL Server 2005, and was all fine, until about a week ago.

I have tried Google, but couldn't really find any useful link to my situation, 
although there are lots of link to the same error.  I'm suspecting some kind of 
OS patch or such which changed behaviour of ADO or MDAC or SQL Server.

Anyone has a suggestion to my situation?  I'm not keen on changing all the code 
to use different logic, as it would require fair amount of coding and testing.

Thanks,

Edward


--------------------------------------------------------------------------------
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe

Reply via email to