TextBox value is passed as empty string and hence it will work even if ALLOW NULLS is False.
To avoid that add a checking to pass NULL instead of empty string.
string val = !string.IsNullOrEmpty(txtName.Text) ? txtName.Text : null;
This way the variable val will always contain empty NULL if textbox is blank