2012-09-24 82 views

回答

2

您可以使用事件RowUpdated讓行的參考:

yourAdapter.RowUpdated += OnRowUpdated; 

然後:

protected static void OnRowUpdated(object sender, SqlRowUpdatedEventArgs args) 
{ 
    if (args.Status == UpdateStatus.ErrorsOccurred) 
    { 
     // Reference to row which throws error 
     var row = args.Row; 

     row.RowError = args.Errors.Message; 
     args.Status = UpdateStatus.SkipCurrentRow; 

     // Do something more 
    } 
}