Search This Blog

Wednesday, February 26, 2014

Read XMLTYPE Oracle C#

C# > Oracle.DataAccess > Read XMLTYPE 

An OracleXmlType object represents an Oracle XMLType instance.

Example:


OracleConnection con = new OracleConnection() ;
con.ConnectionString = "Data Source=sid; User ID=xx; Password=xx; enlist=false; ";
con.Open();
OracleCommand xmlCmd = new OracleCommand();
xmlCmd.CommandText = "select xml from table ";
xmlCmd.Connection = con;
OracleDataReader poReader = xmlCmd.ExecuteReader();
OracleXmlType poXml;
while (poReader.Read())
{
     poXml = poReader.GetOracleXmlType(0);    
}

con.Close();