FYI: workaround for report sql and the error "System.Xml.XmlException: The '#' character, hexadecimal value 0x23, cannot be included in a name."

Monday, August 25, 2014
Avatar
FYI:  If you are writing report SQLand run into the following error:  "System.Xml.XmlException: The '#' character, hexadecimal value 0x23, cannot be included in a name."

...then make sure you aren't selecting two columns from two separate tables with the exact same name.  Use aliasing to prevent the problem.

For example, the following SQL will cause a problem:

SELECT rel.NAME, req.NAME FROM SpiraTestEntities.R_Releases AS rel LEFT JOIN SpiraTestEntities.R_Requirements AS req on rel.RELEASE_ID = req.RELEASE_ID WHERE rel.PROJECT_ID = ${ProjectId}

The following SQL is equivalent except the column name aliases will preclude the aforementioned error:

SELECT rel.NAME AS rel_Name, req.NAME AS req_NAME FROM SpiraTestEntities.R_Releases AS rel LEFT JOIN SpiraTestEntities.R_Requirements AS req on rel.RELEASE_ID = req.RELEASE_ID WHERE rel.PROJECT_ID = ${ProjectId}

1 Replies
Thursday, August 28, 2014
Avatar
re: jfreed Monday, August 25, 2014
Thanks for the information, Jon!

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Monday, August 25, 2014
  • Last Reply: Thursday, August 28, 2014
  • Replies: 1
  • Views: 8627