I am usiing the code below to calculate the sum of rows in my datatable with the productcode in the textbox but if the code is not in the datatable I get the error "conversion from dbnull to sting is not valid". How can i trap this error in this scenario.
Try
RadTextBox8.Text = myTable.Compute("SUM(PercentageInMix)", "ProductCode = '" & txtProductCode.Text & "' ")
Catch ex As Exception
MsgBox(ex.Message)
End Try
I even tried this its still giving me the error
RadTextBox8.Text = myTable.Compute("SUM(PercentageInMix)", String.IsNullOrEmpty("ProductCode = '" & txtProductCode.Text & "' "))