Quantcast
Channel: SQL Server Data Access forum
Viewing all articles
Browse latest Browse all 4164

Switch from current encoding to specified encoding not supported exception

$
0
0
Hello Everyone,

I have a set of XML files which I load into my db, I am getting the following exception (see bottom).  It seems to break on the line "XMLDataImporter.ImportFromXML..."

Anyone have any ideas?

        public static void LoadControlData(ControlDataSet dataSet)
        {
            string baseDocumentPath = Configuration.ReadAppSetting<string>(TEST_DOCUMENT_PATH_SETTING_KEY);
            string dataSetDirectory = null;

            switch (dataSet)
            {
                case ControlDataSet.Base:
                    dataSetDirectory = "Control\\Base";
                    break;

            }

            string datasetDocumentPath = Path.Combine(baseDocumentPath, dataSetDirectory);

            // We start by disabling referential integrity
            DisableReferentialIntegrity(DatabaseUtil.ecommerceConnectionString);

            // Then we load all of the tables
            foreach (string tableName in controlImportDataTables)
            {
                string importFile = Path.Combine(datasetDocumentPath, tableName + ".xml");
                log.Debug("Loading: " + importFile);
                XMLDataImporter.ImportFromXML(importFile, tableName);
            }

            // Then we re-enable referential integrity
            EnableReferentialIntegrity(DatabaseUtil.ecommerceConnectionString);
        }




System.Data.SqlClient.SqlException : The error description is 'Switch from current encoding to specified encoding not supported.'.
Could not find prepared statement with handle 0.
sp_xml_removedocument: The value supplied for parameter number 1 is invalid.
DECLARE @xmlHandle INT; DECLARE @xmlDataXPath VARCHAR(300); EXEC sp_xml_preparedocument @xmlHandle OUTPUT, @xmlText; SELECT @xmlDataXPath = '//BA_BUSINESSACCOUNT';INSERT INTO BA_BUSINESSACCOUNT SELECT * FROM OPENXML (@xmlHandle, @xmlDataXPath, 2) WITH BA_BUSINESSACCOUNT EXEC sp_xml_removedocument @xmlHandle
The XML parse error 0xc00ce56f occurred on line number 1, near the XML text "<?xml version="1.0" encoding="utf-8"?>".
The statement has been terminated.



Viewing all articles
Browse latest Browse all 4164

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>