Reading xml file into database table produces extra characters in the the table column.
-
Wednesday, October 10, 2012 5:11 PM
Hi;
I am attempting to store XML data into a database table field which works but the there are some
extra characters which are included with the string. i.e. ascii charaters whch look like two boxes followed
by the string value.
Is this the result of reading in the XML using the outer element :
XmlNodeList elem_IDNumber = incomingxml_doc.GetElementsByTagName("IDNUM"); String IDNumber = elem_LoanNumber[0].InnerText;cmd.CommandType = CommandType.StoredProcedure; //Loan Number Param cmd.Parameters.Add("@LNKEY", SqlDbType.VarChar, 20).Value = Id_Num;Or are these characters added when I add a parameter to my database table ?
Here is a test XML file that I use too:
<DataFeedback DocId="999999999-9999-9" IDNumber="000000000" AsOf="2010-11-10T10:33:06.093" FeedbackType="AIXML" FeedbackStatusCode="" FeedbackMessage="n/a"> <Contents> <Content Name="OADI" Type="XML"> <Data> <IDNUM> <NUM> 123456 </NUM> </NUM> </Data> </Content> </Contents> </DataFeedback>Thanks for any insights !
GeeMann
- Moved by Vicky Song Thursday, October 11, 2012 5:32 AM (From:Visual Studio Database Development Tools (Formerly "Database Edition Forum"))
All Replies
-
Thursday, October 11, 2012 5:31 AM
Hi GeeMann,
I am moving your case to the XML, System.Xml, MSXML and XmlLite forum so that you can get better support.
Thanks.
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
-
Thursday, October 11, 2012 9:24 AM
Well with XML you have the full range of Unicode characters, to use the same on the data base side I would suggest to use SqlDbType.NVarChar instead of VarChar.MVP Data Platform Development My blog
- Marked As Answer by GeeMann Wednesday, October 24, 2012 7:21 PM

