How to use XML datatype with OleDB (deprecation of sqlclient)

Stephen Hulbert 0 Reputation points
2025-04-15T14:25:43.9566667+00:00

Migrating packages from SQL2017 to SQL2022.

One package contains a script which creates its own connection.

It uses SqlConnection and associated objects.

Moving over to use OleDbConnection.

The following line is causing problems.

//SqlParameter xmlOutputParameter = new SqlParameter("@oParameterXML", SqlDbType.Xml, -1);
OleDbParameter xmlOutputParameter = new OleDbParameter("@oParameterXML", OleDbType.Xml, -1);

OleDbType does not contain a value for Xml.

Any ideas?

(AI said this:

Additionally, since OLE DB is not recommended for new application development, consider transitioning to the Microsoft OLE DB Driver for SQL Server or other modern data access technologies for better support and functionality.

What?)

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,681 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.