I have a data table that I use for Bulk Copying into a SQL server Database: I define its columns as follows:
dt.Columns.Add("BaseID", typeof(Int32));
dt.Columns.Add("ContractID", typeof(DateTime));
dt.Columns.Add("TermID",typeof(Int32));
dt.Columns.Add("Price",typeof(Decimal));
dt.Columns.Add("PeakType",typeof(String));
Now the PeakType column could actually be a string or it could be null. So when I add rows to my data table I do this.
DataRow row = dt.NewRow();
row["BaseID"] = baseID;
row["ContractDate"] = contractDate;
row["TermID"] = termID;
row["Price"] = price;
row["PeakType"] = peakType; //How would I assign If I want to assign DBNull?
How do I specify DBNull.Value if peakType is null so that my bulk copy would correctly insert a null in the column in the SQL server table
DBNull.Value? - Yuriy Galanter