Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7397827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:47:48+00:00 2026-05-29T03:47:48+00:00

I have a table with the column’s datatype as xml in SQL Server 2005.

  • 0

I have a table with the column’s datatype as xml in SQL Server 2005. I created a stored procedure to insert values into that column.

But when calling the SP from code in C#, its giving me an error

Failed to convert parameter value from a XDocument to a String.

Can anyone help with this?

This is the stored procedure I created:

Create Procedure [dbo].[TestReportRepository_Save]
@ReportExecutionTime datetime,
@ReportFile xml,

as
begin

insert into TestReportRepository(ReportExecutionTime,ReportFile) values(@ReportExecutionTime,@ReportFile)

end

The C# code is

DbParameter dbParam1 = dac.Parameter("@ReportExecutionTime", ReportExecutionTime, DbType.DateTime, ParameterDirection.Input);
DbParameter dbParam2 = dac.Parameter("@ReportFile", xmlDoc.Document, DbType.Xml, ParameterDirection.Input);

DbParameter[] dbParamColl = new DbParameter[] { dbParam1, dbParam2 };
long reportID = dac.Save("TestReportRepository_save", dbParamColl);

Please help me identify what I am doing wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T03:47:49+00:00Added an answer on May 29, 2026 at 3:47 am

    When passing this parameter – pass not XDocument object, but its string representation.

    For XmlDocument it is XmlDocument.OuterXml, find one for XDocument and pass it

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Database: Sql Server I have table column named page_text which contains following value I
I have got SQL Server database in which Table column name have spaces. For
I have a table with a column whose values come from an Enumeration. I
I have table column filled with float values e.g.: id-Values 1- 0.19230769230769232 2- 8.4848484848484854E
i have table and column varchar type column id and values are m1, m2,
i have table and column id, and the values are 1, 2 ,3,...,10,11,12,13. how
I have a table in a SQL 2005 database which is brand new. As
I have a table column that contains values such as abc_1_2_3_4.gif or zzz_12_3_3_45.gif etc.
I have a set of data created by another app and stored in XML
I have table with a column that contains multiple values separated by comma (,)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.