EF + ODP.NET + CLOB = Value Cannot be Null - Parameter name: byteArray?

前端 未结 6 2239
死守一世寂寞
死守一世寂寞 2020-12-16 01:12

Our project recently updated to the newer Oracle.ManagedDataAccess DLL\'s (v 4.121.2.0) and this error has been cropping up intermittently. We\'ve fixed it a few times with

6条回答
  •  死守一世寂寞
    2020-12-16 02:09

    We have this problem as well on some computers, and we are running the latest Oracle.ManagedDataAccess.dll (4.121.2.20150926 ODAC RELEASE 4).

    We found a solution to our problem, and I just wanted to share.

    This was our problem that occurred some computers.

    Using connection As New OracleConnection(yourConnectionString)
        Dim command As New OracleCommand(yourQuery, connection)
        connection.Open()
    
        Using reader As OracleDataReader = command.ExecuteReader()
            Dim clobField As String = CStr(reader.Item("CLOB_FIELD"))
        End Using
    
        connection.Close()
    End Using
    

    And here's the solution that made it work on all computers.

    Using connection As New OracleConnection(yourConnectionString)
        Dim command As New OracleCommand(yourQuery, connection)
        connection.Open()
    
        Using reader As OracleDataReader = command.ExecuteReader()
            Dim clobField As String = reader.GetOracleClob(0).Value
        End Using
    
        connection.Close()
    End Using
    

提交回复
热议问题