locked
DBNull error trying to call stored proc RRS feed

  • Question

  • User73307320 posted

    I have a recordset in a gridview that comes from an outer joint that creates null values in the recordset


    When I write to the database using stored proc defined in datasource I get dbnull error.

    I'm trying to process the onDeleting event in the code behind but don't know what to write or if that's the best way


    I need to call a stored proc and if the last parameters value is null then the stored proc does one thing, if it's no null it does something else.


    However DBNull doesn't ssem to be working.


    any help?

    Friday, January 7, 2011 6:35 AM

Answers

  • User814673218 posted

    Hi chambrick,

    You can use case statement for that purpose.

    CASE WHEN FieldName IS NULL THEN 'Do task A' ELSE 'Do task B' END AS FieldName


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 7, 2011 6:49 AM