Board index » delphi » Operation cannot be performed while executing asynchronously

Operation cannot be performed while executing asynchronously


2007-11-14 10:50:43 AM
delphi167
I'm not too sure what is causing this exception to be raised but I
will try and explain what is occurring to the best of my ability...
In our application written in Delphi which uses ADO Components to
connect to a MS SQL 2005 Server (SP2), I run a procedure in our Delphi
Application which does the following...
Creates an ADO Connection
Creates a DataSet which uses said connection
Opens the DataSet and copy's the result set into memory
Closes the DataSet
Change the SQL statement
Open the Dataset
At this point the program excepts, citing the error message "Operation
cannot be performed while executing asynchronously"
To clarify the last step in the process... Using the Same DataSet I
modify the SQL and Open it again. The SQL Points to the same View and
Joins the same Tables as the first SQL pretty much... for unknown
reasons at this point the application crashes. Always.
In the chance that this is helpful, I am pasting the SQL below, My
apologies as it is lengthy:
(First Dataset Query)
SELECT Distinct(MC.DigitString), MC.*, MCBC.BillCode, BC.BillCodeName
FROM v_MaxCosting as MC
LEFT JOIN MaxCostingBillCode as MCBC on
(MC.CarrierRouteCode=MCBC.CarrierRouteCode) AND
(MC.DigitString=MCBC.DigitString) AND (MCBC.EndDate is Null)
LEFT JOIN BillCode as BC on (MCBC.BillCode=BC.BillCode)
WHERE MC.CarrierRouteCode='VER-INT'
AND CostingImportDetailID=(SELECT Max(CostingImportDetailID) FROM
v_MaxCosting as MC2 WHERE (MC2.EffectiveDate=(SELECT
Max(EffectiveDate) FROM v_MaxCosting as MC3 WHERE
(EffectiveDate<'2007-09-18')
AND (MC3.CarrierRouteCode='VER-INT') AND
(MC3.DigitString=MC.DigitString))) AND (MC2.CarrierRouteCode='VER-
INT') AND (MC.DigitString=MC2.DigitString))
Order By MC.DigitString
(Second Dataset Query)
SELECT Distinct(MC.DigitString), MC.*, MCBC.BillCode, BC.BillCodeName
FROM v_MaxCosting as MC
LEFT JOIN MaxCostingBillCode as MCBC on
(MC.CarrierRouteCode=MCBC.CarrierRouteCode) AND
(MC.DigitString=MCBC.DigitString) AND (MCBC.EndDate is Null)
LEFT JOIN BillCode as BC on (MCBC.BillCode=BC.BillCode)
WHERE MC.CarrierRouteCode='VER-INT'
AND CostingImportDetailID=(SELECT Max(CostingImportDetailID) FROM
v_MaxCosting as MC2 WHERE (MC2.EffectiveDate='2007-09-18') AND
(MC2.CarrierRouteCode='VER-INT') AND (MC.DigitString=MC2.DigitString))
Order By MC.DigitString
Here is the SQL of the View:
SELECT TOP (100) PERCENT dbo.MaxCosting.CostingImportID,
dbo.MaxCosting.CostingImportDetailID, dbo.MaxCosting.EffectiveDate,
dbo.MaxCosting.DigitString, dbo.MaxCosting.Cost,
dbo.MaxCosting.Comment, dbo.MaxCosting.Lookup,
dbo.MaxCostingLookup.CarrierRouteCode,
dbo.MaxCostingLookup.CurrencyCode
FROM dbo.MaxCosting INNER JOIN
dbo.MaxCostingLookup ON
dbo.MaxCosting.CostingImportID = dbo.MaxCostingLookup.CostingImportID
Thanks for any help on this issue,
Cheers,
Mark England
 
 

Re:Operation cannot be performed while executing asynchronously

Quote
In our application written in Delphi which uses ADO Components to
connect to a MS SQL 2005 Server (SP2), I run a procedure in our Delphi
Application which does the following...

Creates an ADO Connection
Creates a DataSet which uses said connection
Opens the DataSet and copy's the result set into memory
Closes the DataSet
Change the SQL statement
Open the Dataset
Yes but ADO does not have DataSets, only ADO.NET does.
"microsoft.public.data.ado" caters for ADO only (on-topic) not ADO.NET
(off-topic)
You want to post to one of the 100's of Microsoft newsgroups that have
"dotnet" somewhere in the title.
Thanks
Stephen Howe
 

Re:Operation cannot be performed while executing asynchronously

<XXXX@XXXXX.COM>writes
Quote
I'm not too sure what is causing this exception to be raised but I
will try and explain what is occurring to the best of my ability...

In our application written in Delphi which uses ADO Components to
connect to a MS SQL 2005 Server (SP2), I run a procedure in our Delphi
Application which does the following...

Creates an ADO Connection
Creates a DataSet which uses said connection
Opens the DataSet and copy's the result set into memory
Closes the DataSet
Change the SQL statement
Open the Dataset

At this point the program excepts, citing the error message "Operation
cannot be performed while executing asynchronously"

<snipped>
[Warning less that satisfactory response follows! <g>]
I'm confused by the use of the term "DataSet". ADO doesn't have DataSets it
has Recordsets. So are you using the ADODB (COM) library or are you perhaps
using ADO.Net components?
If you are using ADO. Then the problem is likely because you need a new
instance of a Recordset. It is difficult to provide any other information
because we don't know how you are creating or opening the Recordset in the
first place. (Connection.Execute, Command, or Recordset.Open)
If you are using ADO.Net then you need to post in a ADO.Net newsgroup.
(though the problem is essentially the same).
hth
-ralph
 

Re:Operation cannot be performed while executing asynchronously

On Nov 15, 4:50 am, "Ralph" <XXXX@XXXXX.COM>writes:
Quote
[Warning less that satisfactory response follows! <g>]

I'm confused by the use of the term "DataSet". ADO doesn't have DataSets it
has Recordsets. So are you using the ADODB (COM) library or are you perhaps
using ADO.Net components?

If you are using ADO. Then the problem is likely because you need a new
instance of a Recordset. It is difficult to provide any other information
because we don't know how you are creating or opening the Recordset in the
first place. (Connection.Execute, Command, or Recordset.Open)

If you are using ADO.Net then you need to post in a ADO.Net newsgroup.
(though the problem is essentially the same).

hth
-ralph
Hi Ralph,
Thanks for the response, I knew it was possibly the wrong place to
post here... mostly due to my lack of understanding as to what role
ADO plays in my application. The components I am using are actually a
component set created by RemObjects specifically for Delphi called
Data Abstract. The DatSet is a Component from this set. My apologies
for not including this in my description of my issue as I thought that
this issue could still be an ADO/DataBase issue to do with my Query
rather than the DataSet. I have also posted the same question in the
Data Abstract News Groups and will await an answer there also.
Thank you,
Mark