🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Delete row problem(Join Statement)

#4131
From: Ivan Mihailov
Date: Thu, 21 Mar 2002 21:08
47 lines
2756 bytes
Hi,
Check this link and you will find  the answer of your question

http://www.microsoft.com/mspress/books/sampchap/3445.asp

Ivan

"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: <3c9a4bba_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!hub1.nntpserver.com!hub1.meganetnews.com!newsfeed.sjc.globix.net!cyclone-sf.pbi.net!64.245.249.51!sfo2-feed1.news.digex.net!intermedia!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!news-in.superfeed.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <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 13:10:05 PST
From: "Ivan Mihailov" <iradev@mail.vega.bg>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3c99721b_1@dnews>
Subject: Re: Delete row problem(Join Statement)
Date: Thu, 21 Mar 2002 23:08:04 +0200
Lines: 49
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 212.39.81.152
Message-ID: <3c9a4bba_2@dnews>
X-Trace: dnews 1016744890 212.39.81.152 (21 Mar 2002 13:08:10 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!hub1.nntpserver.com!hub1.meganetnews.com!newsfeed.sjc.globix.net!cyclone-sf.pbi.net!64.245.249.51!sfo2-feed1.news.digex.net!intermedia!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!news-in.superfeed.net!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews