🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #4120

Delete row problem(Join Statement)

#4120
From: Junlin Xie
Date: Thu, 21 Mar 2002 05:37
32 lines
2367 bytes
Hi,
    I am using a TADODataSet to query data from SQL Server 7, there are 2
table joined in SQL, like the following:

select od.OrderID, od.OrderDate, Cust.CustCode, od.BuyerRef, od.Brand,
od.ShippingMethod, od.ShipmentFrom, od.ShipmentTo, od.Consignee,
od.PaymentTerm, od.CreditDays, od.PriceTerm, od.ReqDeLvDate, od.ReqDateDes,
od.RealDelvDate,  od.RealDateDes, od.DelvCountry, od.PriceUnit, od.Quantity,
od.Amount, od.TotalWeight, od.TotalSize, od.Confirmation, od.Approved,
od.ApprovedBy, od.Status, od.OrderTypeID, od.DeptID  from Orders od left
join  Customers Cust on Cust.CustID = od.CustID where (od.OrderDate Between
:StartDate and :EndDate) and (od.DeptID = :DeptID or od.CustID = :CustID)

    When I delete a row from DataSet, I just want to delete the row in the
first table(Orders), Using DataSet->Delete(), but It also delete the second
table( Customers ) row, What's wrong with me.

    The following tracing message are from SQL Server Profiler after I
execute the delete operation:
sp_executesql N'DELETE FROM "CELDB".."Customers" WHERE "CustID"=@P1', N'@P1
varchar(12)', '2018        '
go
sp_executesql N'DELETE FROM "CELDB".."Orders" WHERE "OrderID"=@P1', N'@P1
varchar(20)', 'PI02D03051          '

    How can I delete only primary table row in a joined query?

    by the way, I'm using BCB5 and SQL7.

Thank you very much

Junlin Xie
Technical Details
Message-ID: <3c99721b_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!207.217.77.43.MISMATCH!newsfeed1.earthlink.net!newsfeed.earthlink.net!feed2.news.rcn.net!rcn!netnews.com!opentransit.net!fu-berlin.de!news.boerde.de!nntp.cs.uni-magdeburg.de!PeerFeed.KWeb.on.ca!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,f7d2e7ab12e8d60e,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-03-20 21:40:24 PST
Reply-To: "Junlin Xie" <jlxie@yahoo.com>
From: "Junlin Xie" <jlxie@yahoo.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Delete row problem(Join Statement)
Date: Thu, 21 Mar 2002 13:37:51 +0800
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
NNTP-Posting-Host: 202.105.138.4
Message-ID: <3c99721b_1@dnews>
X-Trace: dnews 1016689179 202.105.138.4 (20 Mar 2002 21:39:39 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!207.217.77.43.MISMATCH!newsfeed1.earthlink.net!newsfeed.earthlink.net!feed2.news.rcn.net!rcn!netnews.com!opentransit.net!fu-berlin.de!news.boerde.de!nntp.cs.uni-magdeburg.de!PeerFeed.KWeb.on.ca!dnews