4
I’m trying to catch the sql
generated by IQueryable
, but is returning:
SELECT NULL AS [EMPTY]
I expected something like:
SELECT i FROM lista WHERE i > 20;
Like I’m doing:
IDbConnection conn = new MySqlConnection("server=127.0.0.1;uid=root;pwd=;database=teste");
DataContext db = new DataContext(conn);
List<int> lista = new List<int>();
lista.AddRange(new int[] { 10, 25, 50, 35, 16, 100, 30, 22, 5 });
var query = from i in lista where i > 20 select i;
var dc = db.GetCommand(query.AsQueryable());
Console.WriteLine("Command Text: \n{0}", dc.CommandText);
There’s some other way to do it?
what is the "i" ?
– sir_ask
and another question, why are you creating a connection to the database, if you want to access the contents of the list?
– sir_ask
@sir_ask Because it’s the only way I could find to get the sql code.
– Francisco