title: VB.net Oracle Operation is not valid due to the current state of the object
body: <p>Ok, i am really in need of finding a way to do this via a string to clob instead of using the update query to to do all.</p>
  
  <pre><code>Dim theXMLCode As OracleClob
  Dim OracleConnection2 As New OracleConnection()
  Dim dr2 As OracleDataReader
  Dim holdXML As String = ""
  
  Public Function connectToOracleDB2() As Boolean
      OracleConnection2.ConnectionString = "User Id=" &amp; dbUserId &amp; ";Password=" &amp; dbPassword &amp; ";Data Source=(DESCRIPTION=(ADDRESS_LIST=" &amp; _
                                        "(ADDRESS=(PROTOCOL=TCP)(HOST=" &amp; dbHost &amp; ")(PORT=" &amp; dbPort &amp; ")))" &amp; _
                                       "(CONNECT_DATA=(SERVICE_NAME=" &amp; dbServiceName &amp; ")))"
  
      Try
          OracleConnection2.Open()
          Return True
      Catch ee As Exception
          OracleConnection2.Close()
          Return False
      End Try
  End Function
  
      Dim strSQL = "UPDATE   CSR.TARGET ces " &amp; _
                   "SET      (STATUS_CODE, COMPLETE_DATE, DATA) = " &amp; _
                      "(SELECT    'ERROR', '', (:XML_DATA) " &amp; _
                      "FROM       CSR.SOURCE C " &amp; _
                      "WHERE      (c.EID = ces.EID) " &amp; _
                      "AND        c.STATUS_CODE = 'ERROR') " &amp; _
                   "WHERE    EXISTS (SELECT 1 " &amp; _
                   "FROM     CSR.SOURCE C " &amp; _
                   "WHERE    (c.EID = ces.EID) " &amp; _
                   "AND      c.STATUS_CODE = 'ERROR')"
  
          Try
              Dim parmData As New OracleParameter
  
              With parmData
                  .Direction = ParameterDirection.Input
                  .OracleDbType = OracleDbType.Clob
                  .ParameterName = "XML_DATA"
                  .Value = holdXML
              End With
  
              OracleCommand2.Parameters.Add(parmData)
              OracleCommand2.CommandText = strSQL
              OracleCommand2.ExecuteNonQuery()
  </code></pre>
  
  <p>But i get the error:</p>
  
  <p><strong>ERROR: Operation is not valid due to the current state of the object.</strong></p>
  
  <p>On the line:</p>
  
  <pre><code>OracleCommand2.ExecuteNonQuery()
  </code></pre>
  
  <p>Any help would be great to get this thing working :o)</p>
  
  <p>David</p>