mssql query, set non xml data size



I try to convert a few table(MSSQL) into an xml file. the result has been truncated at 2.7 MB (just 2KB before the end).


If I increase the "non xml data" size and "xml data" size in the vs express(SQL>execution settings>query options...>resutls>grid> "non xml data" and "xml data") then I get the exact result


So the query is working fine.


Only problem, I need this in a program(c#) not in the query window.


I use executexmlreader.


Someone has any ideal, what can be wrong?



SqlConnection testConnection = new SqlConnection();
testConnection.ConnectionString = @"Data Source=.\SQLEXPRESS;Integrated Security=True;Connect Timeout=30;";
testConnection.Open();

TestCommand = new SqlCommand("exec prAdvListToXML", testConnection);

XmlReader TestXmlReader = TestCommand.ExecuteXmlReader();
XmlWriter TestFileWriter = XmlWriter.Create(@"C:\temp\output.xml");
TestFileWriter.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-16'");

TestFileWriter.WriteNode(TestXmlReader, true);

No comments:

Post a Comment