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[5].ToString().Trim()) == true)
strPrimeTaxid = dr[6].ToString().Trim();
else
strPrimeTaxid = dr[5].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[5].
Please help, I'm stumped and the file is due to the client tomorrow.
Thanks!