MusicLovingIndianGirl
MusicLovingIndianGirl

Reputation: 5947

Displaying data from backend in Visual Studio

I need to show a value from my table in a label from the front end. I have coded for this as follows.

Dim dbl As New vtisDAL.vtisDALDataContext
Dim dsGetFacultydetails = From f1 In dbl.usp_GetFacultyDetails(Val(lblFacultyID.Text)).AsQueryable

For Each entry In dsGetFacultydetails
    lblLeftDate.Text = entry.DateLeft
Next

The DateLeft column in my table is empty, so I get the following error in the 5th line of my code: Nullable object must have a value.

How do I fix this?

I tried

lblLeftDate.Text = String.IsNullOrEmpty(entry.DateLeft)

But it doesn't work.

Upvotes: 0

Views: 73

Answers (1)

Dhaval
Dhaval

Reputation: 2861

try

lblLeftDate.Text = Convert.ToString(entry.DateLeft)

Upvotes: 2

Related Questions