Forum Stats

  • 3,734,283 Users
  • 2,246,938 Discussions


Oracle data adapter throws a Invalid operation exception

User_CXV0I Member Posts: 1 Green Ribbon
edited Mar 2, 2021 4:21AM in ODP.NET

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())
  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"
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>"


Sign In or Register to comment.