Share via


Set a datatable cell to DBNULL

Question

Sunday, January 10, 2010 11:03 AM

I have a data table, and I need to set  certain cells in it to DBNull. the column type is decimal, and Ive set the AllowDBNulls property to true.
How do I set the certain cells to null?

All replies (2)

Sunday, January 10, 2010 11:23 AM âś…Answered

I actually ment the DataTable, not the grid view.
but just setting

dt[i][j] = DBNull.Value;

works great.


Sunday, January 10, 2010 11:20 AM

look this thread:
DataGridView Cell value (DBNull instead of NULL)