D7 errors with complex dataset command text



Can anyone tell me why this runs just fine from MS SQL 2k EM and QA (it
gives me the results I expect without any errors AND I can edit the columns
from tblCusts):



SELECT tC.*,

(SELECT CASE WHEN COUNT(*) > 0 THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END

FROM tblProd

WHERE tblProd.CustID = tC.CustID) AS ProdPosted,

(SELECT CASE WHEN SUM(tblUsedItems.UsedItems) IS NOT NULL THEN
SUM(tblUsedItems.UsedItems) ELSE CAST(0 AS DECIMAL(8,3)) END

FROM tblUsedItems

WHERE tblUsedItems.CustID = tC.CustID) AS UsedApplied

FROM

tblCusts tC

WHERE tC.RteID = 1245 AND tC.DateOfRun = '05/01/2006'


But the same thing (changing the WHERE so it uses parameters in a
master/detail TADODataSet type of setup):

SELECT tC.*,

(SELECT CASE WHEN COUNT(*) > 0 THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END

FROM tblProd

WHERE tblProd.CustID = tC.CustID) AS ProdPosted,

(SELECT CASE WHEN SUM(tblUsedItems.UsedItems) IS NOT NULL THEN
SUM(tblUsedItems.UsedItems) ELSE CAST(0 AS DECIMAL(8,3)) END

FROM tblUsedItems

WHERE tblUsedItems.CustID = tC.CustID) AS UsedApplied

FROM

tblCusts tC

WHERE tC.RteID = :RteID AND tC.DateOfRun = :DateOfRun



Causes various errors in the IDE? My MDAC is up to date. It even causes D7
to lock up on me when I try to set the connection object back to connected =
false. When setting the dataset object active = true I get errors like
"Access violation at address 77FCD989 in module ntdll.dll. Read of address
FFFFFFFF." Also when I try to turn my connection object to connected or not
connected (which I can normally do just fine withuot any errors) I get a
similar AV but in module msado15.dll.



I really don't think it has anything to do with my parameters in the detail
dataset or the way I'm linking it to the master dataset because the original
CommandText that I've been using for weeks has always been fine:



SELECT
tblCusts.*,
COALESCE(tblProd.ProdID/tblProd.ProdID, ISNULL(tblProd.ProdID, 0)) AS
ProdPosted
FROM
tblCusts
LEFT OUTER JOIN tblProd ON tblCusts.CustID = tblProd.CustID
WHERE RteID = :RteID AND DateOfRun = :DateOfRun



Thanks,



Keith


.



Relevant Pages

  • Re: ODBC/OLE DB Connection Pool
    ... > connection be kept open for the application as this will serialize all ... threads ONCE they are returned to the pool. ... > Tips for ADO Users ... > The ADO Connection object implicitly uses IDataInitialize. ...
    (microsoft.public.data.ado)
  • Re: ODBC/OLE DB Connection Pool
    ... > connection be kept open for the application as this will serialize all ... threads ONCE they are returned to the pool. ... > Tips for ADO Users ... > The ADO Connection object implicitly uses IDataInitialize. ...
    (microsoft.public.inetserver.asp.db)
  • Re: ODBC/OLE DB Connection Pool
    ... > connection be kept open for the application as this will serialize all ... threads ONCE they are returned to the pool. ... > Tips for ADO Users ... > The ADO Connection object implicitly uses IDataInitialize. ...
    (microsoft.public.data.oledb)
  • Re: Garbage Collection and Visual Studio
    ... Don't create the connection object on ... dispose of it. ... >> then use the Dispose method of that class. ... > the same connection object until the form is unloaded. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: not in list problem
    ... > make it work was with the connection object. ... >> are using one global connection while Access is using a different one may ... >>>> connection string to open a recordset, ...
    (microsoft.public.access.formscoding)