Conversion from type ‘DBNull’ to type ‘String’ is not valid
The quick and dirty fix: hfSupEmail.Value = dt.Rows(0)(“SupEmail”).ToString() or for C#: hfsupEmail.Value = dt.Rows[0][“SupEmail”].ToString(); This works very well when your eventual target and the source data are already strings, because any extra .ToString() call for something that’s already a string is likely to be optimized into a no-op by the jitter, and if it’s NULL … Read more