Using Xml parameters

Topics: Data Access Application Block
Jul 16, 2008 at 9:48 AM
Edited Jul 16, 2008 at 10:38 AM
I'm trying to execute an Oracle stored procedure which has parameters of the Oracle type XmlType using the Data Access Application Block.

XmlDocument

doc = new XmlDocument();
doc.Load(
"example.xml");

 

OracleDatabase db = new OracleDatabase(myConnectionString);
DbCommand command = db.GetStoredProcCommand(myStoredProc);
db.AddInParameter(command, "P_XML", DbType.Xml, doc.OuterXml);


The AddInParameter call gives me an exception: Value is not valid for DbType: Xml.
How can I solve this problem?

 

 

Jul 16, 2008 at 4:01 PM
I don't think you can use DbType.Xml here. AFAIK you need to use ODP.NET's OracleDbType.XmlType for this, mapping it to a string object.

Fernando


ngruson wrote:
I'm trying to execute an Oracle stored procedure which has parameters of the Oracle type XmlType using the Data Access Application Block.

XmlDocument

doc = new XmlDocument();
doc.Load(
"example.xml");

 

 

OracleDatabase db = new OracleDatabase(myConnectionString);
DbCommand command = db.GetStoredProcCommand(myStoredProc);
db.AddInParameter(command, "P_XML", DbType.Xml, doc.OuterXml);


The AddInParameter call gives me an exception: Value is not valid for DbType: Xml.
How can I solve this problem?

 

 




Jul 16, 2008 at 9:08 PM
I've got it working with ODP.NET now. Version 10.1 of this Oracle client doesn't handle stored procedures with XmlType parameters well (when the xml of my output parameter contains diacritic characters), but version 10.2 does. So now I'm using that version instead of DAAB.