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