Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 6th, 2008, 08:45 AM
Registered User
 
Join Date: Oct 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to skip errors

Hello,
I am loading my csv file into the sql server using C#.net. I want to skip any errors occured during this insert and display those at the end of the process. It should not affect the insert process of remaining rows. Also, I want to show how many rows got inserted?"

how do I do this?
Thanks in advance.


 
Old October 6th, 2008, 09:56 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

That's a pretty broad question, and largely depends on the code you have and the technology you are using. E.g. starting an Integration Service package from C# is quite different from looping through the lines in a text file.

Typically, you loop through each item, and try to insert it (or manually validate the data before you try the insert). If you do this in a try/catch block, it's easy to keep track of failures, and the number of successful rows.

Vague answers, but that's because the question is vague... ;)

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
skip first field gilgalbiblewheel Classic ASP Databases 1 July 7th, 2007 05:10 PM
how to skip from one page to other rashmipant PHP How-To 2 December 8th, 2006 05:20 AM
Why would this skip record #1? dep XSLT 8 November 1st, 2006 02:57 PM
Skip a row rochak SQL Server DTS 2 September 27th, 2005 11:06 PM
Skip On Refresh Prabhakar_dt Classic ASP Basics 9 September 2nd, 2004 11:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.