Hi everybody,
I have this:
[code]
Dim IJavaValue As String = "" '= System.DBNull.Value.ToString()
If String.IsNullOrEmpty(IJavaValue.ToString().Trim) = True Then
IJavaValue = DBNull.Value
End If
[/code]
Then I get the message: Error 43 Value of type 'System.DBNull' cannot be converted to 'String'
And if I try this: IJavaValue = DBNull.Value.ToString()
But then If I look in the Databse I see an empty column and not the value 'NULL' in the column
Thank you

VulpesRank #55 · 29.2K reputationPosted Apr 23, 2014, 2:08 AM EDT
If it's a nullable column, it will then be set automatically to null.
Jignesh TrivediRank #16 · 50.3K reputationPosted Apr 23, 2014, 2:24 AM EDT
Agree with Vulpes.
Are you tried below code?
IJavaValue = null; (this is C# syntax)
VulpesRank #55 · 29.2K reputationPosted Apr 23, 2014, 2:42 AM EDT
As the Value property is of Object type you can set it to DBNull.Value without falling foul of any type conversion rules.
If it's a string column, then using DBNull.Value.ToString() won't work as this just produces an empty string.