I want to bring records stored in my SQL server DB to my form in VB.NET, I did below coding and it works fine but is there any other better way to handle NULL value from DB column that is going to be displayed in the textbox?
If DBNull.Value.Equals(dt.Rows(0).Item("fine_amt")) Then
txtFine_amt.Text = ""
Else
txtFine_amt.Text = dt.Rows(0).Item("fine_amt")
End If
If we don't handle Null value then it is going to throw an error: Conversion from type 'DBNull' to type 'String' is not valid