Hi Bjorn,

>From what I know, you cannot modify a collection while
iterating through it with an enumerator.
You could retrieve the row(s) from the dataset, exit the
loop and then delete it/them.

HTH,

- Nicolas

> -----Original Message-----
> From: Bjorn Eriksen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 14, 2002 17:03
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] Delete in for each iteration
>
>
> Hi,
>
> for each datarow in aDataset
>  if condition then
>    datarow.delete
>  end if
> next
>
> The code above works perfect if the dataset was created from
> the database.
> But if I manually create a dataset and add rows to the
> dataset and run the
> code above I get an error: Collection was modified;
> enumeration operation
> may not execute.
>
> I use a typed dataset, SqlClient, Northwind and VB.net
>
> /Bjorn


This message is for information purposes only and its content should not be
construed as an offer, or solicitation of an offer, to buy or sell any
banking or financial instruments or services and no representation or warranty is 
given in
respect of its accuracy, completeness or fairness.  The material is subject
to change without notice.  You should take your own independent tax, legal and other
professional advice in respect of the content of this message. This message may contain
confidential or legally privileged material and may not be copied, redistributed or 
published
(in whole or in part) without our prior written consent.  This email may have been
intercepted, partially destroyed, arrive late, incomplete or contain viruses and no
liability is accepted by any member of the Credit Agricole Indosuez group as a result. 
 If you are
not the intended recipient of this message, please immediately notify the sender and 
delete
this message from your computer.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to