I have this:
If String.IsNullOrEmpty(editTransactionRow.pay_id.ToString()) = False Then stTransactionPaymentID = editTransactionRow.pay_id 'Check for null value End If
Now, when editTransactionRow.pay_id is Null Visual Basic throws an exception. Is there something wrong with this code?
If you are using a strongly-typed dataset then you should do this:
You are getting the error because a strongly-typed data set retrieves the underlying value and exposes the conversion through the property. For instance, here is essentially what is happening:
The GetValue method is returning DBNull which cannot be converted to a short.