DataRow substring works fine unless there is a null value.
Posted on 2006-05-08
I am trying to convert a datarow value to a substring and it works fine unless the value of the datarow is null. I've tried several if statements and none seem to be working.
Here's my code to the substring
foreach(DataRow dm in dt.Rows)
My datatableresults display in a datagrid which will always have some of these fields with data and some without.
if there isn't any value in the row I get this error
Length cannot be less than zero. Parameter name: length