just nest your try catch inside your loop through the records, it doesn't have to be the entire scope of the method.
On 25 Sep, 09:34, "mushtaq ilyas" <[EMAIL PROTECTED]> wrote: > i completely agree with you but my application is difff since i am > transfering data from db2 as a source database and sql server as a > destination .i am not updating any records just i am inserting .since while > transfering the records which i want to log records which are not inserted > due to any reason .since if i want to use try catch exception handling when > ever the error is coming the insertion stops and catch block is executed to > log the error but i cant resume to next records after logging the error .due > to this reason i prefered unstructured error handling since i can resume to > next records with Resume NExt but i know this is not a good practice thts y > i want to know how can i acheive the same thing using Try Catch .. > > Thanks > > On Wed, Sep 24, 2008 at 10:01 PM, Cerebrus <[EMAIL PROTECTED]> wrote: > > > This is a common scenario. If you're using a DataAdapter, you have the > > RowUpdated event which fires after a Row update has *been attempted*, > > but before any exception has been thrown. In this method you can check > > the RowUpdatedEventArgs.Status property. The fabulous thing is that > > this is a Get-Set property, therefore you can check if Errors have > > occurred. If so, you can set the Status to "SkipCurrentRow". > > > Try to avoid going down the unstructured error handling route whenever > > possible. There is almost always a better option available. The > > probability is that you don't know about it, rather than it being > > absent altogether. I have never needed "On Error GoTo" ever since I > > moved to .NET ! > > > On Sep 23, 9:39 pm, Mushy <[EMAIL PROTECTED]> wrote: > > > Hi guys i need some help i have one application in vb.net where i am > > > transfering data from As400 to sql server .At the time of inserting > > > data into sqlserver i want to catch any errors in the records and > > > insert into ErrorLog table in the sqlserver. The problem i have is > > > since try catch finally block in vb.net is structured and it will > > > catch errors and stop .what i want is insteading on stoping i want to > > > insert those wrong data records in ErrorLog tavble and continue with > > > the next record without stopping. i tried many ways like unsturctured > > > mechanism of ON Error Goto,ON Error Resume Next etc but not getting > > > exaclty what i need. please help me guys if anyone has gone thru > > > similar situation . > > > > Thanks > > > With Best Regards > > > > Mushtaq Ilyas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://cm.megasolutions.net/forums/default.aspx -~----------~----~----~----~------~----~------~--~---
