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:
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.VB Code:
row.vervangartikel_id = IIf(txtVervangcode.Text.Equals(""), DBNull.Value.ToString, txtVervangcode.Text)
Any suggestions are welcome.
Grtz
Nik




Reply With Quote