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.
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.
jcrabtreesla
Member
422 Points
247 Posts
Stongly typed dataset DBNull error
Nov 01, 2006 01:31 PM|LINK
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.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
jcrabtreesla
Member
422 Points
247 Posts
Re: Stongly typed dataset DBNull error
Dec 19, 2006 09:12 PM|LINK
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
grbeckjr
Member
2 Points
1 Post
Re: Stongly typed dataset DBNull error
Jul 01, 2011 02:04 PM|LINK
Not quite so. This solution is not available for columns of type System.DateTime, where the only valid option is "(Throw exception)".
A column "UpdatedDate" is DBNull when a row is first added and will remain so until somebody does an edit.