Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How to catch errors when databinding

Reply
Thread Tools

How to catch errors when databinding

 
 
Axel Dahmen
Guest
Posts: n/a
 
      12-08-2007
Hi,

I'm new to binding a <asp:FormView> control to an <asp:ObjectDataSource> control.

Binding appears to work fine. But I can't find any information on how to deal with errors when they appear, e. g. when a user deletes a row being foreign key referenced by another row in another table, or if he/she inserts a new row creating duplicate keys...

In case of a database error I'd like to show a message like those coming from the <asp:ValidationSummary> control.

Any help is quite appreciated.

Best regards,
Axel Dahmen

 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-10-2007
Hi Axel,

As for ASP.NET ObjectDataSource control, the exception handling behavior
also rely on your code. First, in your data access class(used by
ObjectDataSource), you can manually catch and supress any exception occur
there. Or if you do not catch, it is catched by ObjectDataSource as
unhandled exception. Then, you can check the exception status in
ObjectDataSource's Updated event and choose to whether further throw it or
supress it. Here are two former newsgroup threads in which some community
members have posted some idea on this:

http://www.velocityreviews.com/forum...and-exception-
handling.html

http://www.velocityreviews.com/forum...-handling.html

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: "Axel Dahmen" <(E-Mail Removed)>
>Subject: How to catch errors when databinding
>Date: Sat, 8 Dec 2007 09:02:09 +0100
>
>Hi,
>I'm new to binding a <asp:FormView> control to an <asp:ObjectDataSource>

control.
>Binding appears to work fine. But I can't find any information on how to

deal with errors when they appear, e. g. when a user deletes a row being
foreign key referenced by another row in another table, or if he/she
inserts a new row creating duplicate keys...
>In case of a database error I'd like to show a message like those coming

from the <asp:ValidationSummary> control.
>Any help is quite appreciated.
>Best regards,
>Axel Dahmen
>


 
Reply With Quote
 
 
 
 
Axel Dahmen
Guest
Posts: n/a
 
      12-13-2007
Ah, I see...

Great, thanks Steven! Your help is always very much appreciated!

Best regards,
www.axeldahmen.de
Axel Dahmen


--------------------
"Steven Cheng[MSFT]" <(E-Mail Removed)> schrieb im Newsbeitrag news:Fqh$(E-Mail Removed)...
> Hi Axel,
>
> As for ASP.NET ObjectDataSource control, the exception handling behavior
> also rely on your code. First, in your data access class(used by
> ObjectDataSource), you can manually catch and supress any exception occur
> there. Or if you do not catch, it is catched by ObjectDataSource as
> unhandled exception. Then, you can check the exception status in
> ObjectDataSource's Updated event and choose to whether further throw it or
> supress it. Here are two former newsgroup threads in which some community
> members have posted some idea on this:
>
> http://www.velocityreviews.com/forum...and-exception-
> handling.html
>
> http://www.velocityreviews.com/forum...-handling.html
>
> Hope this helps.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
>
> ==================================================
>
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
>
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> --------------------
> >From: "Axel Dahmen" <(E-Mail Removed)>
> >Subject: How to catch errors when databinding
> >Date: Sat, 8 Dec 2007 09:02:09 +0100
> >
> >Hi,
> >I'm new to binding a <asp:FormView> control to an <asp:ObjectDataSource>

> control.
> >Binding appears to work fine. But I can't find any information on how to

> deal with errors when they appear, e. g. when a user deletes a row being
> foreign key referenced by another row in another table, or if he/she
> inserts a new row creating duplicate keys...
> >In case of a database error I'd like to show a message like those coming

> from the <asp:ValidationSummary> control.
> >Any help is quite appreciated.
> >Best regards,
> >Axel Dahmen
> >

>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to catch errors when databinding Axel Dahmen ASP .Net Web Controls 1 12-05-2007 10:02 AM
Databinding expressions are only supported on objects that have a DataBinding event jobs ASP .Net 0 09-25-2007 11:54 PM
Gridview encoding, or how to run commands before gridview's default databinding, or, how do I disable default databinding at all? Sergei Shelukhin ASP .Net 1 11-12-2006 01:43 PM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM



Advertisments