OracleConnection.InfoMessage for multiple ExecuteReader()
Posted: Fri 17 Aug 2012 14:32
Hi Devart-Team.
I found a strange behaviour at the OracleConnection.InfoMessage-Event.
Let's take a look a this piece of code:
-> Open connection, create command and ExecuteReader() twice.
When executing the 2nd cm.ExecuteReader a InfoMessage-Event for the OracleConnection is generated, with e.Message = "ORA-01403: no data found".
This message is not correct. It makes no difference if you do r1.Read before executing the 2nd ExecuteReader. Furthermore, it does not depend on the commandtext and if it really returns data, e.g.: "Select sysdate from dual where 1=2" will result in the same behaviour (InfoMessage-Event raised at the 2nd ExecuteReader).
Only when altering the CommandText between the 2 ExecuteReader-statements, the InfoMessage is not raised.
Is it our mistake to call ExecuteReader twice? Is the ORA-01403 message generated from Oracle or from Devart?
Regards,
Matthias
I found a strange behaviour at the OracleConnection.InfoMessage-Event.
Let's take a look a this piece of code:
Code: Select all
Private Sub ExecuteSimpleButton_Click(sender As System.Object, e As System.EventArgs) Handles ExecuteSimpleButton.Click
MyOracleConnection.Open()
Try
Dim cm As New Devart.Data.Oracle.OracleCommand
cm.Connection = MyOracleConnection
cm.CommandText = "SELECT sysdate FROM dual"
Dim r1 As Devart.Data.Oracle.OracleDataReader = cm.ExecuteReader
Dim r2 As Devart.Data.Oracle.OracleDataReader = cm.ExecuteReader
Finally
MyOracleConnection.Close()
End Try
End Sub
Private Sub MyOracleConnection_InfoMessage(sender As Object, e As Devart.Data.Oracle.OracleInfoMessageEventArgs) Handles MyOracleConnection.InfoMessage
MessageBox.Show(e.Message)
End Sub
When executing the 2nd cm.ExecuteReader a InfoMessage-Event for the OracleConnection is generated, with e.Message = "ORA-01403: no data found".
This message is not correct. It makes no difference if you do r1.Read before executing the 2nd ExecuteReader. Furthermore, it does not depend on the commandtext and if it really returns data, e.g.: "Select sysdate from dual where 1=2" will result in the same behaviour (InfoMessage-Event raised at the 2nd ExecuteReader).
Only when altering the CommandText between the 2 ExecuteReader-statements, the InfoMessage is not raised.
Is it our mistake to call ExecuteReader twice? Is the ORA-01403 message generated from Oracle or from Devart?
Regards,
Matthias