> ' Adjust a dataset to avoid null values > ' expO1 Dataset > Public Function AdjustDataSetToAvoidNullValue(ByVal toDataSet As DataSet) As DataSet > Dim ldDate As Date = oApp.GetEmptyDate() > Dim loColumn As DataColumn > Dim loRow As DataRow > Dim loTable As DataTable > > For Each loTable In toDataSet.Tables > For Each loRow In loTable.Rows > For Each loColumn In loTable.Columns > If IsDBNull(loRow.Item(loColumn.ColumnName)) Then > > Select Case loColumn.DataType.ToString > > Case "System.DateTime" > loRow.Item(loColumn.ColumnName) = ldDate > > Case "System.Integer" > loRow.Item(loColumn.ColumnName) = 0 > > Case "System.Decimal" > loRow.Item(loColumn.ColumnName) = 0 > > Case "System.Boolean" > loRow.Item(loColumn.ColumnName) = False > > Case Else > loRow.Item(loColumn.ColumnName) = "" > > End Select > > End If > Next > Next > Next > > Return toDataSet > End Function >>
UPDATE SomeDataTable SET ; SomeColumn = SomeDefaultValue ; WHERE ISNULL( SomeColumn )That way, you'd be executing ( "a lot of fields" ) SQL statements, instead of ( "a lot of fields" ) * ( lots of rows [e.g. 7000] ) If... Select Case code blocks.