ExecuteQuery
Posted: Wed 26 Feb 2014 19:20
Hi all,
Just wondering if anyone else has seen this before. It might just be me as it's late in the day.
I've writen a code block where I can pass in a value which is evaluated by a switch statement to then set a variable accordingly.
This variable is used to access a database table via the ExecuteQuery method.
I have changed the variable types but for this example i've left as 'var'. Instead of getting the 4 million odd records returned as a total count I get: 68 'D' returned. When using the Linq to SQL approach and the table specifically stated in my code everything works fine. However in the interests of code efficiency I wanted pass the table name dynamically hence using the ExecuteQuery method.
thanks in advance!
Just wondering if anyone else has seen this before. It might just be me as it's late in the day.
I've writen a code block where I can pass in a value which is evaluated by a switch statement to then set a variable accordingly.
This variable is used to access a database table via the ExecuteQuery method.
Code: Select all
var getVolume = context.ExecuteQuery(typeof(int),"SELECT COUNT(*) as vol FROM my_table1").ToString().FirstOrDefault();
thanks in advance!