Article View: borland.public.cppbuilder.database.ado
Article #4128Re: Delete row problem(Join Statement)
From: Lee Gan
Date: Thu, 21 Mar 2002 15:15
Date: Thu, 21 Mar 2002 15:15
46 lines
2509 bytes
2509 bytes
I would use another SQL statement to achieve deletion. DELETE FROM od WHERE od.ID = SomeID; Lee Gan "Junlin Xie" <jlxie@yahoo.com> wrote in message news:3c99721b_1@dnews... > 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:
<3c99f8ff_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!news.boerde.de!nntp.cs.uni-magdeburg.de!PeerFeed.KWeb.on.ca!dnewsReferences:
<3c99721b_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,f7d2e7ab12e8d60e X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-03-21 07:26:57 PST From: "Lee Gan" <leegan@hotmail.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3c99721b_1@dnews> Subject: Re: Delete row problem(Join Statement) Date: Thu, 21 Mar 2002 08:15:09 -0700 Lines: 48 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 207.34.102.197 Message-ID: <3c99f8ff_1@dnews> X-Trace: dnews 1016723711 207.34.102.197 (21 Mar 2002 07:15:11 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!fu-berlin.de!news.boerde.de!nntp.cs.uni-magdeburg.de!PeerFeed.KWeb.on.ca!dnews