Nulls and While dr.Read question
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:
dr = cmd.ExecuteReader
If dr.HasRows Then
While dr.Read()
txtFName.Text = dr("FirstName")
txtLName.Text = dr("LastName")
txtRate.Text = Format(dr("HrlyRate"), "Fixed")
txtBaseRate.Text = Format(dr("HrlyRate"), "Fixed")
txtPrDept.Text = dr("PRDept")
txtCrew.Text = dr("Crew")
txtClass.Text = dr("Class")