Is there a way to find out which columns are nullable in a DataTable? I know that there is a proprety: DataColumn.AllowDBNull, which can be set to true or false in the design mode of the DataSet, but I would like to have this information directly from the database.
I am having a DGV populated with values from a MySQL database and have bound the DataSource of the DGV to a DataTable.
You can use the following to determine which DataColumns in a DataTable are nullable (have
AllowDBNull
set to true):As a solution I decided to retrieve the Columns Schema of the Database and from there assign which Collumns AllowDBNull: