Preserving NULL values in a Double Variable

前端 未结 3 1691
眼角桃花
眼角桃花 2020-12-21 16:58

I\'m working on a vb.net application which imports from an Excel spreadsheet.

If rdr.HasRows Then
        Do While rdr.Read()
            If rdr.GetValue(0).         


        
3条回答
  •  青春惊慌失措
    2020-12-21 17:25

    I don't know which API you're using to do database inserts, but with many of them, including ADO.NET, the proper way to insert nulls is to use DBNull.Value. So my recommendation is that you use Nullable(Of Double) in your VB code, but then when it comes time to do the insert, you'd substitute any null values with DBNull.Value.

提交回复
热议问题