AllowDBNull in DataTables

  • Thread starter Thread starter elziko
  • Start date Start date
E

elziko

I use a data adapter to fill a DataTable (that contains no row or columns)
with data from a table in my SQL Server Express database.

The columns that the DataAdapter creates in my DataTable all have the
correct datatype but each is created so that AllowDBNull = True. However,
the table in the SSE Database has columns where NULLs are not allowed.

Any idea why this information isn't making it from teh database to the
DataTable?

Whats more, if I try and change the change the columns in the DataTable
myself after the Fill() method is called, setting AllowDBNull = True seems
to have no effect. Why would this be?

TIA
 
Hi elziko,

DataAdapter basically only retrieves data and data type, and set
column'AllowDBNull to default true. You can change it to not allow null value
(false).

HTH

Elton Wang
 
Back
Top