Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 25th, 2006, 08:09 AM
Registered User
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default detailsview not updating table when null column

Hello ... I have a form that is straight forward, with little code behind (code is for a more friendly error msg when attempting insert,update, delete from a detailsview). I have had this problem before and the usual fix of reconfiguring the sqldataAdapter and detailsview does not work. The problem is when I have a row that contains column with a null value it will not update or delete. I can insert the row with a column that contains a null value, but cannot update or delete it. There is no error or exception thrown, the row simply fails to update or delete.

I am curious to know if anyone else is having this problem? If so what did you do to fix it?

Any information is certainly appreciated ... Thanks!


Old October 31st, 2006, 04:09 PM
Friend of Wrox
Join Date: Feb 2006
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts

I think that if you post your code I might be able to help. It's very hard to guess at things without seeing any code.

Neil Timmerman
Veris Consulting
Old October 31st, 2006, 06:01 PM
Registered User
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for the offer to help. Actually I fixed (circumvented) the problem by not allowing any nulls in all columns. I then checked the columns before updating/inserting and plugged in a value.
Working fine this way ... again thanks for the offer!

Old April 11th, 2007, 06:59 AM
Registered User
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts


I am having the same problem as specified as above, but want to allow null values in certain columns is there anyway of allowing this to happen?

My code is as follows:

<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="COMPONENT_ID,C_INTERNAL_VERSION"
        DataSourceID="SqlDataSource3" Height="50px" Width="125px">
            <asp:BoundField DataField="COMPONENT_ID" HeaderText="COMPONENT_ID" ReadOnly="True"
                SortExpression="COMPONENT_ID" />
            <asp:BoundField DataField="C_INTERNAL_VERSION" HeaderText="C_INTERNAL_VERSION" ReadOnly="True"
                SortExpression="C_INTERNAL_VERSION" />
            <asp:BoundField DataField="C_VERSION" HeaderText="C_VERSION" SortExpression="C_VERSION" />
            <asp:BoundField DataField="C_COMMISSIONED_DATE" HeaderText="C_COMMISSIONED_DATE"
                SortExpression="C_COMMISSIONED_DATE" />
            <asp:BoundField DataField="C_DEOMMISSIONED_DATE" HeaderText="C_DEOMMISSIONED_DATE"
                SortExpression="C_DEOMMISSIONED_DATE" />
            <asp:BoundField DataField="C_DECOMM_REASON" HeaderText="C_DECOMM_REASON" SortExpression="C_DECOMM_REASON" />
            <asp:BoundField DataField="PLAT_ID" HeaderText="PLAT_ID" SortExpression="PLAT_ID" />
            <asp:BoundField DataField="PLAT_IVER" HeaderText="PLAT_IVER" SortExpression="PLAT_IVER" />
            <asp:BoundField DataField="COMPONENT_TYPE_ID" HeaderText="COMPONENT_TYPE_ID" SortExpression="COMPONENT_TYPE_ID" />
            <asp:BoundField DataField="C_NAME" HeaderText="C_NAME" SortExpression="C_NAME" />
            <asp:BoundField DataField="C_DESCRIPTION" HeaderText="C_DESCRIPTION" SortExpression="C_DESCRIPTION" />
            <asp:BoundField DataField="C_AUDIT_INFO" HeaderText="C_AUDIT_INFO" SortExpression="C_AUDIT_INFO" />
            <asp:CommandField ShowEditButton="True" />
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" OldValuesParameterFormatString="original_{0}" ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>"
            <asp:Parameter Name="C_VERSION" Type="String" />
            <asp:Parameter Name="C_COMMISSIONED_DATE" Type="DateTime" />
            <asp:Parameter Name="C_DEOMMISSIONED_DATE" Type="DateTime" />
            <asp:Parameter Name="C_DECOMM_REASON" Type="String" />
            <asp:Parameter Name="PLAT_ID" Type="Decimal" />
            <asp:Parameter Name="PLAT_IVER" Type="Decimal" />
            <asp:Parameter Name="COMPONENT_TYPE_ID" Type="Decimal" />
            <asp:Parameter Name="C_NAME" Type="String" />
            <asp:Parameter Name="C_DESCRIPTION" Type="String" />
            <asp:Parameter Name="C_AUDIT_INFO" Type="String" />
            <asp:Parameter Name="original_COMPONENT_ID" Type="Decimal" />
            <asp:Parameter Name="original_C_INTERNAL_VERSION" Type="Decimal" />
            <asp:Parameter Name="original_C_VERSION" Type="String" />
            <asp:Parameter Name="original_C_COMMISSIONED_DATE" Type="DateTime" />
            <asp:Parameter Name="original_C_DEOMMISSIONED_DATE" Type="DateTime" />
            <asp:Parameter Name="original_C_DECOMM_REASON" Type="String" />
            <asp:Parameter Name="original_PLAT_ID" Type="Decimal" />
            <asp:Parameter Name="original_PLAT_IVER" Type="Decimal" />
            <asp:Parameter Name="original_COMPONENT_TYPE_ID" Type="Decimal" />
            <asp:Parameter Name="original_C_NAME" Type="String" />
            <asp:Parameter Name="original_C_DESCRIPTION" Type="String" />
            <asp:Parameter Name="original_C_AUDIT_INFO" Type="String" />
            <asp:ControlParameter ControlID="DropDownList1" DefaultValue="1" Name="COMPONENT_ID"
                PropertyName="SelectedValue" Type="Decimal" />
            <asp:ControlParameter ControlID="DropDownList2" DefaultValue="1" Name="C_INTERNAL_VERSION"
                PropertyName="SelectedValue" Type="Decimal" />

Similar Threads
Thread Thread Starter Forum Replies Last Post
DetailsView and Column Widths AspNetGuy ASP.NET 3.5 Basics 1 June 7th, 2008 04:34 PM
DetailsView "Out of range" error when updating rsearing ASP.NET 2.0 Basics 16 August 17th, 2007 07:38 AM
Problem with updating the detailsview control rakesh225 ASP.NET 2.0 Professional 1 August 2nd, 2006 10:45 AM
How do you set a column to NULL in a parameter? Aaron Edwards ASP.NET 2.0 Basics 1 April 7th, 2006 11:26 PM
Updating Unique Identifier foreign key to NULL jraymond VB Databases Basics 0 June 16th, 2003 01:51 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.