<HTML><HEAD><TITLE>[DUG] Rhino Mocks</TITLE>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18999"></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">
<DIV>This 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:</DIV>
<DIV> </DIV>
<DIV> if ClientDataSet1.active then
ClientDataSet1.close; <== maybe add this</DIV>
<DIV> ADOQueryEdit.SQL.Text:=’xxxxxxxxx’;</DIV>
<DIV> DataSetProvider1.Dataset:=ADOQueryEdit;</DIV>
<DIV> ClientDataSet1.Providername:=DataSetProvider1;</DIV>
<DIV> ClientDataSet1.FetchParams;</DIV>
<DIV> ClientDataSet1.Open;</DIV>
<DIV> </DIV>
<DIV>(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.</DIV>
<DIV> </DIV>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">John</DIV>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"></DIV>
<DIV style="FONT: 10pt tahoma">
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=edwardh@slingshot.co.nz
href="mailto:edwardh@slingshot.co.nz">Edward Huang</A> </DIV>
<DIV><B>Sent:</B> Monday, February 21, 2011 8:54 PM</DIV>
<DIV><B>To:</B> <A title=delphi@delphi.org.nz
href="mailto:delphi@delphi.org.nz">'NZ Borland Developers Group - Delphi
List'</A> </DIV>
<DIV><B>Subject:</B> [DUG] Object was open</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011>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.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011>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.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011>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.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011>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.</SPAN></FONT><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011> I'm suspecting some kind of OS patch or such
which changed behaviour of ADO or MDAC or SQL Server.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011>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.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011>Thanks,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=248354407-21022011>Edward</SPAN></FONT></DIV>
<P>
<HR>
_______________________________________________<BR>NZ Borland Developers Group -
Delphi mailing list<BR>Post: delphi@delphi.org.nz<BR>Admin:
http://delphi.org.nz/mailman/listinfo/delphi<BR>Unsubscribe: send an email to
delphi-request@delphi.org.nz with Subject:
unsubscribe</DIV></DIV></DIV></BODY></HTML>