Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

Post by Dan Terril » Sat, 02 Nov 2002 02:19:58



I'm getting a weird error when I pass Xml to a stored procedure in .net. I
have an object that I serialize to Xml, then try to send the resulting text
to a stored procedure. Everything runs fine if I call the SP in Query
Analyzer, but when I call it in .Net I get the following error: "XML parsing
error: Invalid at the top level of the document.". The error occurs when I
call sp_xml_preparedocument.

Any ideas what could be wrong? Code snippets and XML doc is below

calling the SP:
string strXml = SerializationHelper.SerializeToXml(this); //just turns the
object into an XML doc.
SqlCommand cmdSave = new SqlCommand("sp_SaveCompany", conn);
cmdSave.CommandType = CommandType.StoredProcedure;
cmdSave.Parameters.Add(new SqlParameter("@sxml", SqlDbType.Text));
cmdSave.Parameters["@sxml"].Value = strXml;
cmdSave.Parameters["@sxml"].Size = strXml.Length;
cmdSave.ExecuteNonQuery();

The Exception I get:

{"XML parsing error: Invalid at the top level of the document." }
[System.Data.SqlClient.SqlException]: {System.Data.SqlClient.SqlException}
System.Object: {System.Data.SqlClient.SqlException}
_COMPlusExceptionCode: -532459699
_className: null
_exceptionMethod: null
_exceptionMethodString: null
_message: "System error."
_innerException: null
_helpURL: null
_stackTrace: {System.Array}
_stackTraceString: null
_remoteStackTraceString: null
_remoteStackIndex: 0
_HResult: -2146232060
_source: null
_xptrs: 0
_xcode: -532459699
Message: "XML parsing error: Invalid at the top level of the document."
InnerException: null
TargetSite: {System.Reflection.RuntimeMethodInfo}
StackTrace: " at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at BenefitCentral.Entities.Company.Save(SqlConnection conn) in
c:\bcdotnet\entities\company.cs:line 110
at BenefitCentral.Tester.lstQuotes_SelectedIndexChanged(Object sender,
EventArgs e) in c:\bcdotnet\tester.aspx.cs:line 442"
HelpLink: ""
Source: ".Net SqlClient Data Provider"
HResult: -2146232060

The stored procedure I'm calling:
CREATE procedure sp_SaveCompany(@sxml  text) as
    EXEC sp_xml_preparedocument @idoc OUTPUT, @sxml
    (snip)

And, finally, the XML document I'm passing (sorry, it's kinda big). Had to
edit out some personal info, but that's it.

<?xml version="1.0"?>
<EmpGroup xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<EffectiveDate>2002-06-01T00:00:00.0000000-04:00</EffectiveDate>

<iOwnerId>12</iOwnerId>

<address>

<AddressOne />

<AddressTwo />

<City>Springfield</City>

<State>MA</State>

<ZipCode>01102</ZipCode>

<ContactInfo>

<Type>Telephone_Number</Type>

<Value />

</ContactInfo>

</address>

<Contactinfo>

<Type>Telephone_Number</Type>

<Value />

</Contactinfo>

<Name>Amy</Name>

<ID>23110</ID>

<SICCode />

<SalaryClassList />

<OwnerId>12</OwnerId>

<Employees>

<anyType xsi:type="Person">

<Age>53</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02420</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Female</Gender>

<DOB>1948-10-06T00:00:00.0000000-04:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>WAV</CoverageLevel>

<ID>391005</ID>

<Firstname>Jonathan</Firstname>

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>48</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02420</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1953-12-19T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>FAM</CoverageLevel>

<ID>391006</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>56</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02155</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1946-01-27T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>FAM</CoverageLevel>

<ID>391007</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>38</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>01742</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1963-11-14T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>FAM</CoverageLevel>

<ID>391008</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>39</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02482</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1963-01-12T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>FAM</CoverageLevel>

<ID>391009</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>22</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02467</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Female</Gender>

<DOB>1979-11-03T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>WAV</CoverageLevel>

<ID>391010</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>33</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>01945</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1969-01-03T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>FAM</CoverageLevel>

<ID>391011</ID>

<Firstname/>

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>34</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02144</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1968-05-10T00:00:00.0000000-04:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>EE</CoverageLevel>

<ID>391012</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>28</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>01887</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Female</Gender>

<DOB>1973-11-18T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>EE</CoverageLevel>

<ID>391013</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>52</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>01561</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Female</Gender>

<DOB>1950-04-12T00:00:00.0000000-04:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>EE</CoverageLevel>

<ID>391014</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>34</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02474</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1967-09-19T00:00:00.0000000-04:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>EE</CoverageLevel>

<ID>391015</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>43</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02478</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1958-11-22T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>FAM</CoverageLevel>

<ID>391016</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>47</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02493</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />

<Salary />

<Occupation />

<DentalCoverage>0</DentalCoverage>

<VisionCoverage>0</VisionCoverage>

<Gender>Male</Gender>

<DOB>1955-02-07T00:00:00.0000000-05:00</DOB>

<IsCobra>false</IsCobra>

<CoverageLevel>FAM</CoverageLevel>

<ID>391017</ID>

<Firstname />

<OwnerId>2</OwnerId>

</anyType>

<anyType xsi:type="Person">

<Age>43</Age>

<SalaryClasses />

<DependantLife>false</DependantLife>

<Retired>false</Retired>

<Zipcode>02421</Zipcode>

<HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

<Comments />
...

read more »

 
 
 

Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

Post by Christoph Schittk » Sat, 02 Nov 2002 06:53:16


Did you make sure that strXml is well-formed XML ?

--
Christoph Schittko
Software Architect

"Dan Terrill" <dterr...@dontbothermedamnit.com> wrote in message

news:#P3d5FQgCHA.2272@tkmsftngp10...
> I'm getting a weird error when I pass Xml to a stored procedure in .net. I
> have an object that I serialize to Xml, then try to send the resulting
text
> to a stored procedure. Everything runs fine if I call the SP in Query
> Analyzer, but when I call it in .Net I get the following error: "XML
parsing
> error: Invalid at the top level of the document.". The error occurs when I
> call sp_xml_preparedocument.

> Any ideas what could be wrong? Code snippets and XML doc is below

> calling the SP:
> string strXml = SerializationHelper.SerializeToXml(this); //just turns the
> object into an XML doc.
> SqlCommand cmdSave = new SqlCommand("sp_SaveCompany", conn);
> cmdSave.CommandType = CommandType.StoredProcedure;
> cmdSave.Parameters.Add(new SqlParameter("@sxml", SqlDbType.Text));
> cmdSave.Parameters["@sxml"].Value = strXml;
> cmdSave.Parameters["@sxml"].Size = strXml.Length;
> cmdSave.ExecuteNonQuery();

> The Exception I get:

> {"XML parsing error: Invalid at the top level of the document." }
> [System.Data.SqlClient.SqlException]: {System.Data.SqlClient.SqlException}
> System.Object: {System.Data.SqlClient.SqlException}
> _COMPlusExceptionCode: -532459699
> _className: null
> _exceptionMethod: null
> _exceptionMethodString: null
> _message: "System error."
> _innerException: null
> _helpURL: null
> _stackTrace: {System.Array}
> _stackTraceString: null
> _remoteStackTraceString: null
> _remoteStackIndex: 0
> _HResult: -2146232060
> _source: null
> _xptrs: 0
> _xcode: -532459699
> Message: "XML parsing error: Invalid at the top level of the document."
> InnerException: null
> TargetSite: {System.Reflection.RuntimeMethodInfo}
> StackTrace: " at
> System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior,
> RunBehavior runBehavior, Boolean returnStream)
> at System.Data.SqlClient.SqlCommand.ExecuteScalar()
> at BenefitCentral.Entities.Company.Save(SqlConnection conn) in
> c:\bcdotnet\entities\company.cs:line 110
> at BenefitCentral.Tester.lstQuotes_SelectedIndexChanged(Object sender,
> EventArgs e) in c:\bcdotnet\tester.aspx.cs:line 442"
> HelpLink: ""
> Source: ".Net SqlClient Data Provider"
> HResult: -2146232060

> The stored procedure I'm calling:
> CREATE procedure sp_SaveCompany(@sxml  text) as
>     EXEC sp_xml_preparedocument @idoc OUTPUT, @sxml
>     (snip)

> And, finally, the XML document I'm passing (sorry, it's kinda big). Had to
> edit out some personal info, but that's it.

> <?xml version="1.0"?>
> <EmpGroup xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

> <EffectiveDate>2002-06-01T00:00:00.0000000-04:00</EffectiveDate>

> <iOwnerId>12</iOwnerId>

> <address>

> <AddressOne />

> <AddressTwo />

> <City>Springfield</City>

> <State>MA</State>

> <ZipCode>01102</ZipCode>

> <ContactInfo>

> <Type>Telephone_Number</Type>

> <Value />

> </ContactInfo>

> </address>

> <Contactinfo>

> <Type>Telephone_Number</Type>

> <Value />

> </Contactinfo>

> <Name>Amy</Name>

> <ID>23110</ID>

> <SICCode />

> <SalaryClassList />

> <OwnerId>12</OwnerId>

> <Employees>

> <anyType xsi:type="Person">

> <Age>53</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>02420</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Female</Gender>

> <DOB>1948-10-06T00:00:00.0000000-04:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>WAV</CoverageLevel>

> <ID>391005</ID>

> <Firstname>Jonathan</Firstname>

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>48</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>02420</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Male</Gender>

> <DOB>1953-12-19T00:00:00.0000000-05:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>FAM</CoverageLevel>

> <ID>391006</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>56</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>02155</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Male</Gender>

> <DOB>1946-01-27T00:00:00.0000000-05:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>FAM</CoverageLevel>

> <ID>391007</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>38</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>01742</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Male</Gender>

> <DOB>1963-11-14T00:00:00.0000000-05:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>FAM</CoverageLevel>

> <ID>391008</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>39</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>02482</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Male</Gender>

> <DOB>1963-01-12T00:00:00.0000000-05:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>FAM</CoverageLevel>

> <ID>391009</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>22</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>02467</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Female</Gender>

> <DOB>1979-11-03T00:00:00.0000000-05:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>WAV</CoverageLevel>

> <ID>391010</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>33</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>01945</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Male</Gender>

> <DOB>1969-01-03T00:00:00.0000000-05:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>FAM</CoverageLevel>

> <ID>391011</ID>

> <Firstname/>

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>34</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>02144</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Male</Gender>

> <DOB>1968-05-10T00:00:00.0000000-04:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>EE</CoverageLevel>

> <ID>391012</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>28</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>01887</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Female</Gender>

> <DOB>1973-11-18T00:00:00.0000000-05:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>EE</CoverageLevel>

> <ID>391013</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>52</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>01561</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Female</Gender>

> <DOB>1950-04-12T00:00:00.0000000-04:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>EE</CoverageLevel>

> <ID>391014</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>34</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>02474</Zipcode>

> <HireDate>0001-01-01T00:00:00.0000000-05:00</HireDate>

> <Comments />

> <Salary />

> <Occupation />

> <DentalCoverage>0</DentalCoverage>

> <VisionCoverage>0</VisionCoverage>

> <Gender>Male</Gender>

> <DOB>1967-09-19T00:00:00.0000000-04:00</DOB>

> <IsCobra>false</IsCobra>

> <CoverageLevel>EE</CoverageLevel>

> <ID>391015</ID>

> <Firstname />

> <OwnerId>2</OwnerId>

> </anyType>

> <anyType xsi:type="Person">

> <Age>43</Age>

> <SalaryClasses />

> <DependantLife>false</DependantLife>

> <Retired>false</Retired>

> <Zipcode>02478</Zipcode>

...

read more »

 
 
 

Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

Post by Dan Terril » Sat, 02 Nov 2002 22:50:08


Sure did, Christopher. It's fine -- and what's weird, it runs fine if I run
the same query, with the same XML, in Query Analyzer.


Quote:> Did you make sure that strXml is well-formed XML ?

 
 
 

Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

Post by Christoph Schittk » Sun, 03 Nov 2002 10:11:41


Can you put SQL Profiler on your database to check what's being sent to SQL
Server? Then take that statement and run it in Query Analyzer and see what
happens.

HTH,
Christoph Schittko


> Sure did, Christopher. It's fine -- and what's weird, it runs fine if I
run
> the same query, with the same XML, in Query Analyzer.


message

> > Did you make sure that strXml is well-formed XML ?

 
 
 

Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

Post by Dan Terril » Tue, 05 Nov 2002 00:52:37


Yeah, I tried that, and it's sending exactly what I pass it. I've even tried
writing that value to a new table, so I could look at it closer.
Everything's being passed correctly. It's plain weird, that's what it is.
 
 
 

Xml Parsing Error sending valid Xml to stored procedure from ADO.Net / C#

Post by Christoph Schittk » Tue, 05 Nov 2002 01:35:16


If you can execute the exact failing statement from Query Analyzer, I'd say
it's a bug.  I don't understand it since the error seems to indicate that
the passed XML is corrupt, but the XML you posted looks fine.

Sounds like something to report to Microsoft. Someone from there might pick
it up here in this newsgroup, but your chances may be better in
microsoft.public.sqlserver.xml. I saw you already posted there, but maybe
you could try again listing all the details you posted here.

S'm sorry I could not be of more help.
Christoph


Quote:> Yeah, I tried that, and it's sending exactly what I pass it. I've even
tried
> writing that value to a new table, so I could look at it closer.
> Everything's being passed correctly. It's plain weird, that's what it is.

 
 
 

1. Error when sending large image to SQL Server via ADO.NET & Stored Procedure

Hello,

I have an application that stores images in the database. I use SQL Server
2000 and VB.NET.  I have a table with a column of type image.  I also have a
stored procedure that does the insert with a parameter of type image.  The
local data type being passed to the stored procedure is a byte array
(byte()).

A 6k image stores just fine. At 32k, I get the following error:

---------------------------------------------------
A severe error occurred on the current command. The results, if any, should
be discarded. at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream) at
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
---------------------------------------------------

And, if I look in the event viewer, I see that MSSQLSVR reports the
following error:

---------------------------------------------------
Error: 17805, Severity: 20, State: 3
Invalid buffer received from client.
---------------------------------------------------

Has anyone seen this? I found some old support documents talking about
problems with SQL Server 6.5, but nothing on SQL Server 2000 (which is what
I use).

Thanks!

Brian

2. Encrypting Office documents stored on netdisks

3. System.Xml.XmlTextReader.ParseRoot() error when reading xml file from treenode TreeNodeSrc

4. Employment Opportunities Bulletin

5. VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET USA/Canada

6. Refresh Screen After Deleting Record

7. Stored Procedure, ADO.NET (VB) Error handling and generating error messages.

8. Reading bookreader files

9. 2 x xml parse to 1 xml

10. Send MS SQL Server 2005 stored procedure a variable from within a C# application

11. Proper way to trigger a long running stored procedure (C# / ADO.NET)

12. (Encrypted) "Stored Procedure does not exist" -- error returned when called by ADO.NET

13. Send XML to an HTTP server and get the server XML response back