The way I would do this is to use the parameters collection of the command object.
Code:
cmd.parameters(0).value = dbnull.value
if you can't/don't use parameters (eg dynamically generated SQL), then you'll have to figure out some way of using the SQL keyword NULL instead of the value of the variable
eg
Code:
strNumber = iif(txtBox1.text = "", "null", txtBox1.text)
strSQL = "update MyTable set MyField = " & strNumber & " where ID = " & intID.tostring
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.