[Mono-bugs] [Bug 526794] New: Inserting empty string saved as null in sql server

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jul 30 11:00:48 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=526794


           Summary: Inserting empty string saved as null in sql server
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.4.x
          Platform: x86-64
        OS/Version: RHEL 5
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: srfcanada at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; WOW64;
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648;
NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8)

If I insert a row where one of thw string collumns contains an empty string,
what ends up being inserted is null. Using the sql server profiler I can see
the actual sql statment being sent and the column contains null rather that an
empty string. Trying it on windows shows the correct empty string so it seems
mono is turning an empty string into a null. As far as I know it shouldnt be
doing that unless I supply a DbNull type for the parameter. I use nhibernate
orm so I cant verify the actual ado command used but this is the tracing
information it gives showing the ado command its preparing:

INSERT INTO dbo.[EntityLabel] ([commitcount], [Saved], [Username], [Comment],
[IsSnapshot], [Name], [Created], [Description], Id) VALUES (@p0, @p1, @p2, @p3,
@p4, @p5, @p6, @p7, @p8); @p0 = '1', @p1 = '', @p2 = 'Default', @p3 = '', @p4 =
'False', @p5 = '', @p6 = '7/28/2009 9:11:29 AM', @p7 = '', @p8 =
'1c0a122a-1e26-4fc7-af5b-70c19f783188' 

note its using empty string rather than null but mono is switching this to null
for some reason.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
Configure bugmail: http://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