How to catch errors when databinding

Discussion in 'ASP .Net Web Controls' started by Axel Dahmen, Dec 8, 2007.

  1. Axel Dahmen

    Axel Dahmen Guest

    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
     
    Axel Dahmen, Dec 8, 2007
    #1
    1. Advertising

  2. 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/forums/t98767-objectdatasource-and-exception-
    handling.html

    http://www.velocityreviews.com/forums/t297625-formview-error-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/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.

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


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


    --------------------
    >From: "Axel Dahmen" <>
    >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
    >
     
    Steven Cheng[MSFT], Dec 10, 2007
    #2
    1. Advertising

  3. Axel Dahmen

    Axel Dahmen Guest

    Ah, I see...

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

    Best regards,
    www.axeldahmen.de
    Axel Dahmen


    --------------------
    "Steven Cheng[MSFT]" <> schrieb im Newsbeitrag news:Fqh$...
    > 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/forums/t98767-objectdatasource-and-exception-
    > handling.html
    >
    > http://www.velocityreviews.com/forums/t297625-formview-error-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/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    > --------------------
    > >From: "Axel Dahmen" <>
    > >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
    > >

    >
     
    Axel Dahmen, Dec 13, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    985
    Mark Goldin
    Jan 17, 2004
  2. John Black
    Replies:
    8
    Views:
    4,182
    Xenos
    Aug 20, 2004
  3. jobs
    Replies:
    0
    Views:
    1,673
  4. Earl Teigrob
    Replies:
    1
    Views:
    420
    Shravan
    Mar 1, 2004
  5. Axel Dahmen

    How to catch errors when databinding

    Axel Dahmen, Dec 5, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    154
    Axel Dahmen
    Dec 5, 2007
Loading...

Share This Page