I am assigning one datarow object the values of another datarow object. For example:
newAddress.AddrId = frenchAddress.AddrId
newAddress.AddrLn1 = frenchAddress.AddrLn1
newAddress.AddrLn2 = frenchAddress.AddrLn2
newAddress.AddrLn3 = frenchAddress.AddrLn3
newAddress.AddrCityNm = frenchAddress.AddrCityNm
newAddress.CntryId = frenchAddress.CntryId
newAddress.ProvId = frenchAddress.ProvId
Some of the values in frenchAddress
can be NULL so I end up getting an exception because I am assigning newAddress
the value of DBNull
. What is the best and cleanest way of handling DBNull
? Is there anyway to just insert NULL
where there is a DBNull
?
Using VB.Net.
This ended up being the solution I used, a little bit of a mixture between the two answer above. It seems to work ok: