Paolo ponzano - 193 - Jan 5, 2015

Hello Demis,
I’ve a Winform  application and I create a Func<SqlExpression<T>> based on some dropdown to filter a Select using OrmLite… I’ve been asked to add an application log layer to filter what query have been done… is there a way of having a redeable format of that SqlExpression? or do have I to save the last executed SQL Statement on the dbConnection?

Thanks

paolo ponzano:

Thanks Fredrik!
__________

In addition to +Fredrik Forssen above, you can also use db.GetLastSql() to get last Sql executed.
Note: no need to address every q to me, many others here can help as well.

Fredrik Forssen:

IANAD (I Am Not A Demis), but if I remember it correctly each SqlExpression has a method called ToSelectStatement() which returns the SQL string that will be executed by that SqlExpression. :slight_smile: