The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

How can I select a Fixed value Column?

Last post 07-17-2008, 12:07 PM by paschoal1. 3 replies.
Sort Posts: Previous Next
  •  07-16-2008, 1:57 PM 10267

    How can I select a Fixed value Column?

    I want to do reproduce this query n ES. Is it possible? How?

    Code:

    1    select '1' as test, * from employee
    

    where '1' is the value of a C# variable

     So, let's say I have this:

    string name = "John";

    I want to put the value of  the variable "name" inside the query.

    thanks

     

     

     

  •  07-17-2008, 2:24 AM 10273 in reply to 10267

    Re: How can I select a Fixed value Column?

    You will either have to use in-line raw SQL, or a custom Load.

    Code:
    string name = "John";
    
    EmployeesQuery eq = new EmployeesQuery("e");
    eq.Select("<'" + name + "' AS Name>", eq);
    
    EmployeesCollection collection = new EmployeesCollection();
    collection.Load(eq);

    David Neal Parsons
    www.entityspaces.net
  •  07-17-2008, 6:38 AM 10277 in reply to 10273

    Re: How can I select a Fixed value Column?

    To clarify, anything within the < > is passed literally "as is" to your database engine, it's an escape hatch for things we might not support in our Dynamic Query API.
    EntitySpaces | Twitter | BLOG
  •  07-17-2008, 12:07 PM 10280 in reply to 10277

    Re: How can I select a Fixed value Column?

    Just to Correct. Name needs to be enclosed by single quote
    Thanks. Perfect!!!
    Code:
    1    string name = "John";
    2    
    3    EmployeesQuery eq = new EmployeesQuery("e");
    4    eq.Select("<'" + name + "' AS 'Name'>", eq);
    5    
    6    EmployeesCollection collection = new EmployeesCollection();
    7    collection.Load(eq);
    8    
    9    
    

View as RSS news feed in XML