Insert parameter null value

Aug 4, 2011 at 9:03 AM

When using this query:

exec.Insert("Orders",
                        new
                        {
                            data.OrderNr,
                            data.CustomerNr,
                            data.Reference,
                            data.Description,
                        });   
Reference is a nullable field in the database but when data.Reference is null it will fail to insert: "Parameterized query expects a parameter value which was not supplied"

Is it possible to let dbexecutor insert a null value to the database when the value is null?

Aug 4, 2011 at 4:19 PM

Thank you.

It is not good.
I intend to substitute DBNull.Value if value is null.

// like this code...
IDbParameterValue.Value = (value == null) ? DBNull.Value : value;

I fixed to dev blanch and pushed.

Aug 5, 2011 at 9:23 AM

great solution, thanx!