Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle data adapter throws a Invalid operation exception

User_CXV0IMar 2 2021 — edited Mar 2 2021

I recently saw an error logged in our database with text "Oraclecommand.commandtext is invalid". When I checked the code by debugging it, I couldn't find the issue and all the queries we use are working fine.
What could cause this issue? An incorrect query returns ORA errors but not invalidoperation exception.
I read the documentation too, but there is not much detail on it.

  Dim DBAdapter As New OracleDataAdapter
  Dim ds As DataSet
  Using oConn As New OracleConnection(ConnectionString())
  oConn.Open()
  DBAdapter.SelectCommand = New OracleCommand(sqlStatement, oConn)
  DBAdapter.SelectCommand.CommandType = CommandType.Text
  DBAdapter.Fill(ds, "Something")
  End Using



Below are the error details
message="OracleCommand.CommandText is invalid"
source="Oracle.DataAccess"
detail="System.InvalidOperationException: OracleCommand.CommandText is invalid
   
  at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)
   
  at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   
  at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) At <code above>"
Comments
Post Details
Added on Mar 2 2021
3 comments
2,094 views