B
Bob Day
VS 2003
The documentation says " Nothing keyword represents the default value of any
data type" this is simply not true and causing a lot of problems.
1) Consider an SQL table of 3 columns:
Column1 bit no nulls
Column2 string no nulls
Column3 DateTime no nulls
2) then, set each column in a DataSet, DataRowto nothing
Column1 = nothing ' should be 0 false
Column2 = nothing ' should be string.empty
Column3 = nothing ' should be 01/01/0001
If you look at the values in DataRow, Column 1,2 & 3 they do not reflect the
defaults, although they all have some value in them (particularly true with
DateTime)
3) Now, using a DataAdapter for the table add the DataRow to the DataSource.
It fails everytime with a message like: "Cannot write null to non-nullable
Column1".
4) If you manually set the DataRow columns (1,2,3) to their default values,
it works every time.
What does that mean? Nothing does not work. Very frustrating.
Please advise.
Bob Day
The documentation says " Nothing keyword represents the default value of any
data type" this is simply not true and causing a lot of problems.
1) Consider an SQL table of 3 columns:
Column1 bit no nulls
Column2 string no nulls
Column3 DateTime no nulls
2) then, set each column in a DataSet, DataRowto nothing
Column1 = nothing ' should be 0 false
Column2 = nothing ' should be string.empty
Column3 = nothing ' should be 01/01/0001
If you look at the values in DataRow, Column 1,2 & 3 they do not reflect the
defaults, although they all have some value in them (particularly true with
DateTime)
3) Now, using a DataAdapter for the table add the DataRow to the DataSource.
It fails everytime with a message like: "Cannot write null to non-nullable
Column1".
4) If you manually set the DataRow columns (1,2,3) to their default values,
it works every time.
What does that mean? Nothing does not work. Very frustrating.
Please advise.
Bob Day