LINQ with Oracle parameter

2 posts, 0 answers
  1. Carl Nelson
    Carl Nelson avatar
    2 posts
    Member since:
    Nov 2009

    Posted 27 Aug 2012 Link to this post

    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

  2. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 30 Aug 2012 Link to this post

    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!
  3. DevCraft banner
Back to Top