I've seen people using something very similar, with a few small changes:
public static void SetColumnValue(DataRow Row, DataColumn Column, string
value)
{
if (value == string.Empty &&
Column.AllowDBNull) {
Row[Column] = DBNull.Value;
}
else
{
Row[Column] = value;
}
}
This makes assignments even better, or at least shorter
SetColumnValue(Row, Row.TypedTable.LastNameColumn, txtLastName.Text);
I've also seen customers with a little change in the Enterprise Library
that does this check in the low level storage code. There's even a line in
the OracleDatabase class which is commented out, but does this by default.
This is due to the fact that Oracle handles strings differently by
default.
Jesse