0

Usage of method:

DataContext.ExecuteQuery<TResult>(String, Object[]);

The following generates an InvalidOperationException with message:

{"Could not format node 'Value' for execution as SQL."}

int[] ids = new int[] {1, 2, 3};
context.ExecuteQuery<SourceTarget>(select c.* from Customer c where c.customer_id in {0}, ids);

Your help will be really appreciated.

0

1 Answer 1

1

Since you're using LINQ-to-SQL, you could use the LINQ syntax instead of ExecuteQuery, eg:

var customers = from c in context.Customers
                where ids.Contains(c.customer_id)
                select c;

Or, if you insist on making it a SQL query, try:

context.ExecuteQuery<SourceTarget>(String.Format("select c.* from Customer c where c.customer_id in ({0})",
    String.Join(",", ids)));
Sign up to request clarification or add additional context in comments.

Comments

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.