2

I am trying to add parameters using oracle as database using the following code :

for (int i = 1; i <= count; i++)
{
    var parameterName = ":ref_cur" + i;
    DbParameter parameter = Acidaes.Data.DbHelper.CreateRefCursorParameter(
        parameterName, 
        ParameterDirection.Output);
    command.Parameters.Add(parameter);
}

Following Crash occurs while adding parameters

[A]Oracle.DataAccess.Client.OracleParameter cannot be cast to [B]Oracle.DataAccess.Client.OracleParameter. Type A originates from 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' in the context 'Default' at location 'C:\WINDOWS\assembly\GAC_32\Oracle.DataAccess\2.112.2.0__89b483f429c47342\Oracle.DataAccess.dll'. Type B originates from 'Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' in the context 'Default' at location 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342\Oracle.DataAccess.dll'.

Didn't find way to resolve this crash.

1 Answer 1

4

You need to check your references, there is a mismatch in the versions you are looking at:

DbParameter parameter = 
 Acidaes.Data.DbHelper.CreateRefCursorParameter(parameterName, ParameterDirection.Output);

DbParameter as referenced in your code is not of the same type (version in this case) as what is being returned from your DbHelper class. You will need to update these two projects to refer to the same version of Oracle.DataAccess.

Sign up to request clarification or add additional context in comments.

1 Comment

No worries - if you hit the tick at the side of the answer, it will let people know that this answer was 'correct'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.