Asigne un valor nulo a la columna de enteros en la tabla de datos

Asigne un valor nulo a la columna de enteros en la tabla de datos

Una cadena nula/vacía tiene un formato incorrecto; necesitaría detectar ese escenario y compensar:

    DR["CustomerID"] = string.IsNullOrWhiteSpace(text)
        ? DBNull.Value : (object)Convert.ToInt32(text);

DR["CustomerID"] = !string.IsNullOrEmpty(TextBox1.Text)
                   ? Convert.ToInt32(TextBox1.Text)
                   : DBNull.Value;

Pero también debe verificar que el valor sea un número entero válido:

int value;
if(int.TryParse(TextBox1.Text, out value))
{
    DR["CustomerID"] = value;
}
else
{
    DR["CustomerID"] = DBNull.Value;
}

podrías hacerlo así:

DR["CustomerID"] = string.IsNullOrEmpty(TextBox1.Text) ?
    null : Convert.ToInt32(TextBox1.Text);