This is what I'm doing to select and display 3 columns of my datatable in GridView:
The expiry date has null values in many records whose expiry date is not set.Code:Dim myCustomers = From Cust In myDataset.Customers _ Select CustomerId = Cust.CustomerId, _ CustomerName = Cust.CustomerName, _ ExpiryDate = Cust.ExpiryDate DataGridView1.DataSource = myCustomers.ToList
On executing the query I get runtime error:
System.Data.StrongTypingException
"The value for column 'ExpiryDate' in table 'Customers' is DBNull."
Obviously, my LINQ query is wrong or incomplete, but I am not able to figure the way to do it correctly.
Pradeep![]()




icon on the left of the post.
Reply With Quote