I have a datatable with One ColumnName \"CustomerID\" with Integer DataType. Dynamically I want to add rows to the DataTable. For that, I had created one DataRow object like:
When null is not allowed to be inserted into DR["CustomerID"], you could use (int?)null instead like this:
null
DR["CustomerID"]
(int?)null
DR["CustomerID"] = string.IsNullOrEmpty(TextBox1.Text) ? (int?) null : Convert.ToInt32(TextBox1.Text);