user2131722
user2131722

Reputation: 21

asp.net with oracle connectivity issue

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.

Upvotes: 2

Views: 1508

Answers (1)

Paddy
Paddy

Reputation: 33857

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.

Upvotes: 4

Related Questions