My code reads an Excel file and outputs XML. For one value I need to evaluate 2 spreadsheet values to set the XML as in (dr being a datarow):
if (String.IsNullOrEmpty(dr.ToString().Trim()) == true) strPrimeTaxid = dr.ToString().Trim(); else strPrimeTaxid = dr.ToString().Trim();
This works fine for data such as "123456" but not for "56-12345". If I remove the hyphen, everything's fine. The spreadsheet column is unformatted (ie General datatype), and the Excel connection string includes"IMAX=1", which should evaluate all Excel data as string (Text). BTW, the hyphenated value is in dr.
Please help, I'm stumped and the file is due to the client tomorrow.