Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why exception is not catched ?
Message
 
To
24/12/2006 12:49:13
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01180058
Message ID:
01180114
Views:
14
What do you mean by "not catched"? I see that you re-throw the exception at the bottom of the catch. Can it be this line that make you think that this exception is not handled?

>Following C# code runing in .NET 2 causes error in Update() line
>
>Npgsql.NpgsqlException was unhandled by user code
>
>Why exception is not catched ?
>catch must catch ALL exceptions.
>
>
   int RowsUpdated;
>   try {
>       RowsUpdated = datapter.Update(changes);
>     }
>   catch {
>       System.Windows.Forms.MessageBox.Show("error");
>       transact.Rollback();
>     throw;
>     }
>
>
>error message details are:
>
>Npgsql.NpgsqlException was unhandled by user code
> Message="ERROR: 23505: duplicate key violates unique constraint \"konto_pkey\""
> Source="Npgsql"
> BaseMessage="duplicate key violates unique constraint \"konto_pkey\""
> Code="23505"
> Detail=""
> ErrorSql="update \"firma1\".\"konto\" set \"kontonr\" = '2', ....
> File="nbtinsert.c"
> Hint=""
> Line="277"
> Position=""
> Routine="_bt_check_unique"
> Severity="ERROR"
> Where=""
>
> StackTrace:
> at Npgsql.NpgsqlConnector.CheckErrors() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlConnector.cs:line 359
> at Npgsql.NpgsqlConnector.CheckErrorsAndNotifications() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlConnector.cs:line 410
> at Npgsql.NpgsqlCommand.ExecuteCommand() in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 1479
> at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb) in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 633
> at Npgsql.NpgsqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior cb) in c:\Desenvolvimento\NpgsqlBuildOficial2.0\src\Npgsql\NpgsqlCommand.cs:line 601
> at System.Data.Common.DbDataAdapter.UpdateRowExecute(RowUpdatedEventArgs rowUpdatedEvent, IDbCommand dataCommand, StatementType cmdIndex)
> at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform