Help with OracleXML
Posted: Fri 06 Jul 2012 19:12
I'm struggling to render an Oracle select result set as XML
Below is the code I'm using which fails at the line:
Dim myxml As Devart.Data.Oracle.OracleXml = reader.GetOracleXml(1)
The error that I receive is:
Cannot convert object of type 'Devart.Data.Oracle.OracleString' to object of type 'Devart.Data.Oracle.NativeOracleObjectBase'.
I've looked for a good example on the Devart Site and borrowed from the sample but am missing something. The connection appears fine and the reader shows that it has rows before it fails.
Any help?
Protected Sub test3()
Dim cn As New OracleConnection
Dim cmd As New OracleCommand
cmd.CommandText = "SELECT code,name FROM ag_client order by code"
cn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("EMS").ConnectionString
cn.Open()
cmd.Connection = cn
Dim reader As OracleDataReader = cmd.ExecuteReader
Try
If reader.Read Then
>>>error here
Dim myxml As Devart.Data.Oracle.OracleXml = reader.GetOracleXml(1)
End If
Catch
Finally
reader.Close()
End Try
End Sub
Below is the code I'm using which fails at the line:
Dim myxml As Devart.Data.Oracle.OracleXml = reader.GetOracleXml(1)
The error that I receive is:
Cannot convert object of type 'Devart.Data.Oracle.OracleString' to object of type 'Devart.Data.Oracle.NativeOracleObjectBase'.
I've looked for a good example on the Devart Site and borrowed from the sample but am missing something. The connection appears fine and the reader shows that it has rows before it fails.
Any help?
Protected Sub test3()
Dim cn As New OracleConnection
Dim cmd As New OracleCommand
cmd.CommandText = "SELECT code,name FROM ag_client order by code"
cn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("EMS").ConnectionString
cn.Open()
cmd.Connection = cn
Dim reader As OracleDataReader = cmd.ExecuteReader
Try
If reader.Read Then
>>>error here
Dim myxml As Devart.Data.Oracle.OracleXml = reader.GetOracleXml(1)
End If
Catch
Finally
reader.Close()
End Try
End Sub