Board index » delphi » Operation cannot be performed while executing asynchronously
|
MarkStevenEngland
Delphi Developer |
Operation cannot be performed while executing asynchronously2007-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 |
