I've created a strongly typed dataset (MyDataSet) in my .NET app. For the sake of simplicity, we'll say it has one DataTable (MyDataTable), with one column (MyCol).
MyCol has its DataType property set to "System.Int32", and its AllowDBNull property set to "true".
I'd like to manually create a new row, and add it to this dataset. I create the row without a problem, with something like:
MyDataSet.MyDataTableRow myRow = MySimpleDataSet.MyDataTable.NewItemRow();
Fine. However, when I try to set the value to DBNull:
myRow.MyCol = DBNull.Value;
I'm told that I can't do it...that it can't cast that to an int. This makes sense, in a way, since I've defined it to be an int...but then how can I get DBNull in there? Am I not supposed to be able to have DBNull in there? Isn't that what the AllowDBNull property is for?
I'm obviously missing something fundemental. Can someone help explain what it is?
EDIT: I also tried entering "int?" as the DataType, but Visual Studio throws an error when I enter it, saying that "Column requires a valid DataType."