Update Blank Cells with Text in DataTable

Hello,

I have created a data table by querying a database and in one column the data contains both blank cells and cells populated with two digit numbers. After manipulating the data in the created data table and trying to insert it into another database table, I receive an error related to the blank cells in this single column:

Ideally, I would like to replace the blank cells with the text "Null’’ before inserting the data into the table but am not sure how to accomplish this task. Any help would be appreciated. The column is the third in the data table. I am fairly confident the error is resulting from the blank cells because the first row has a two digit number in this column and populates into the database table without issue.

Thanks,

Kyle

Well if your datatable column is of decimal type, you cant have BLANK or text “NULL”, if your database column is nullable, you will have to insert DBNull in those columns before inserting…

Perhaps that is part of the issue, I really just need to understand more clearly how to replace the blank cells with a new value, whether that is ‘Null’ or ‘0’(if it needs to be in decimal format)

oh, you can use Assign like this: DataTable.Rows(i)(0) = DBNull.Value