This is a migrated thread and some comments may be shown as answers.

LINQ with Oracle parameter

1 Answer 47 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Carl Nelson
Top achievements
Rank 1
Carl Nelson asked on 28 Aug 2012, 12:50 AM
This statement works fine:

using(UsersModel context = new UsersModel())
{
    var query =       
        (from user
            in context.UserTable
            where user.UserId = "JoeBlow"
            select user).FirstOrDefault();
}

However, this fails:

using(UsersModel context = new UsersModel())
{
    string id = "JoeBlow";

    var query =      
        (from user
            in context.UserTable
            where user.UserId = id
            select user).FirstOrDefault();
}

It fails because the generated SQL translates the WHERE clause as "WHERE a.UserId = :p01"
Now I recognize this as an OracleParameter value, but OpenAccess should have generated the parameter with name "p01" and value id.

Is there a way to make OpenAccess generate this correctly, and if not, a way to programmatically add the OracleParameter so that the SQL will succeed?

Thanks,
Carl

1 Answer, 1 is accepted

Sort by
0
Viktor Zhivkov
Telerik team
answered on 30 Aug 2012, 03:07 PM
Hi Carl,

The situation that you describe is very strange. 
I have not been able to reproduce the issue using our test environment.
Please send us a project that reproduces the issue (include the data model too) so we can analyze it in detail. Also include the version of Oracle Server and the provider that you are using.

Querying by primary key (as it looks like from your code snippets) is very basic and popular operation and you are the first one to experience such issues.

Please follow up with additional information so we can resolve the issue. 
As a valued Telerik customer you are welcome to post your requests in our Support System and enjoy faster response time and ability to upload files.

Regards,
Viktor Zhivkov
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
Tags
LINQ (LINQ specific questions)
Asked by
Carl Nelson
Top achievements
Rank 1
Answers by
Viktor Zhivkov
Telerik team
Share this question
or