Page view counter

Stongly typed dataset DBNull error

Last post 12-19-2006 5:12 PM by jcrabtreesla. 1 replies.

Sort Posts:

  • Stongly typed dataset DBNull error

    11-01-2006, 9:31 AM
    • Loading...
    • jcrabtreesla
    • Joined on 07-06-2006, 11:16 AM
    • Washington D.C.
    • Posts 243
    • Points 422

    I have a strongly typed dataset that is returning an error when the corresponding field in the database is DBNull. The error I get is:

    System.Data.StrongTypingException was unhandled by user code
      Message="The value for column 'Client_Billing_Contact' in table 'Client' is DBNull."
      Source="App_Code.arfnv1r7"
      StackTrace:
           at slaClient.ClientRow.get_Client_Billing_Contact() in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\slabob\5f562902\4fcd322\App_Code.arfnv1r7.3.vb:line 1662
           at order_orderheader.loadClientData(String clientID) in C:\VS2005\SLABOB\order\orderheader.aspx.vb:line 354
           at order_orderheader.txtClientID_TextChanged(Object sender, EventArgs e) in C:\VS2005\SLABOB\order\orderheader.aspx.vb:line 373
           at System.Web.UI.WebControls.TextBox.OnTextChanged(EventArgs e)
           at System.Web.UI.WebControls.TextBox.RaisePostDataChangedEvent()
           at System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent()
           at System.Web.UI.Page.RaiseChangedEvents()
           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     I tried to trap the error in the code that binds the field to a textbox, but when I set a breakpoint the error happens before it reaches this code. Checking the error above, it happens in a VS created code file.

     I have searched for this error and found that I am not the only one that has this problem. However none of the solutions work for me. I don't know where/how to check for this error. I tried to trap the error in the VS file when I get the error, but that doesn't work either. Help. Thanks.

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Stongly typed dataset DBNull error

    12-19-2006, 5:12 PM
    Answer
    • Loading...
    • jcrabtreesla
    • Joined on 07-06-2006, 11:16 AM
    • Washington D.C.
    • Posts 243
    • Points 422
    Just in case anyone else has this error. I found that in the properties window of the .xsd page there is a setting called NullValue that sets the behavior if one column is Null (you must select a column in the Data Table). Change the setting from Throw Exception to Null or Empty and that will solve the problem.
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Page 1 of 1 (2 items)