[Mono-bugs] [Bug 688773] New: DataTable.ImportRow and DataTable.Merge don't use DefaultValue for missing columns

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 20 09:19:55 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=688773

https://bugzilla.novell.com/show_bug.cgi?id=688773#c0


           Summary: DataTable.ImportRow and DataTable.Merge don't use
                    DefaultValue for missing columns
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: x86
        OS/Version: openSUSE 11.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: vbato.bugs at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=425880)
 --> (http://bugzilla.novell.com/attachment.cgi?id=425880)
Test program

Description of Problem:

If you import a DataRow from DataTable B into DataTable A with A.ImportRow(),
and table A contains a column that is not present in table B, the column's
value will be null instead of the value in the column's DefaultValue property
(DBNull.Value by default).

In other words, when importing a row into a table, all the columns in the table
that are not present in the row being imported will be set to null instead of
their DefaultValue.

The same thing happens if you import rows with DataTable.Merge().

Steps to reproduce the problem:
1. Compile the attached test program with:
gmcs -r:System.Data test.cs
2. run the test program:
mono test.exe


Actual Results:
The output of the program is:
Name = (null)


Expected Results:
The output of the program should be:
Name = (DBNull)


How often does this happen? 
Always.

Additional Information:
It seems that both DataTable.ImportRow() and MergeManager.MergeRow() create new
rows by calling DataTable.NewNotInitializedRow() and never bother to initialize
the columns that are not present in the row being imported.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list