I have a table with a decimal field that allowes null-values. I want to fill this field with a value from a textbox. When I leave the textbox empty, I want to insert an null value, I'm trying it this way:
VB Code:
  1. row.vervangartikel_id = IIf(txtVervangcode.Text.Equals(""), DBNull.Value.ToString, txtVervangcode.Text)
But this is not working, I keep getting an invalid cast error (not allowed decimal to dbnull). It does work with string-fields in the database however.

Any suggestions are welcome.

Grtz

Nik