1- Imports System.ComponentModel
1+ Imports System.ComponentModel
22Imports System.Data.Common
33Imports Npgsql
44
@@ -74,9 +74,13 @@ Public Class Statement
7474 Dim sqlParamValue As Object
7575 For Each prop As PropertyDescriptor In TypeDescriptor.GetProperties(sqlParams)
7676 sqlParamValue = prop.GetValue(sqlParams)
77+ If (sqlParamValue Is Nothing ) Then
78+ sqlParamValue = DBNull.Value
79+ Else
80+ sqlParamValue = Me .getPossibleUnderlyingEnumValue(sqlParamValue)
81+ End If
7782 Me ._cmd.Parameters.AddWithValue(
78- prop.Name,
79- If ((sqlParamValue Is Nothing ), DBNull.Value, sqlParamValue)
83+ prop.Name, sqlParamValue
8084 )
8185 Next
8286 End If
@@ -86,12 +90,17 @@ Public Class Statement
8690 ''' </summary>
8791 ''' <param name="sqlParams">Dictionary with named keys as MySQL/MariaDB statement params without any '@' chars in dictionary keys.</param>
8892 Protected Overrides Sub addParamsWithValue(sqlParams As Dictionary( Of String , Object ))
93+ Dim sqlParamValue As Object
8994 If ( Not sqlParams Is Nothing ) Then
9095 For Each pair As KeyValuePair( Of String , Object ) In sqlParams
96+ If (pair.Value Is Nothing ) Then
97+ sqlParamValue = DBNull.Value
98+ Else
99+ sqlParamValue = Me .getPossibleUnderlyingEnumValue(pair.Value)
100+ End If
91101 Me ._cmd.Parameters.AddWithValue(
92- pair.Key,
93- If ((pair.Value Is Nothing ), DBNull.Value, pair.Value)
94- )
102+ pair.Key, sqlParamValue
103+ )
95104 Next
96105 End If
97106 End Sub
0 commit comments