I am pulling some data to my form from a SQL Server database. I have one field that sometimes has a value and other times has a null. If I try to use the following code I get an error if the class field is null in the database. How can I adjust this code to accept null values if need be?
VB Code:
  1. dr = cmd.ExecuteReader
  2.         If dr.HasRows Then
  3.             While dr.Read()
  4.                 txtFName.Text = dr("FirstName")
  5.                 txtLName.Text = dr("LastName")
  6.                 txtRate.Text = Format(dr("HrlyRate"), "Fixed")
  7.                 txtBaseRate.Text = Format(dr("HrlyRate"), "Fixed")
  8.                 txtPrDept.Text = dr("PRDept")
  9.                 txtCrew.Text = dr("Crew")
  10.                 txtClass.Text = dr("Class")