0

I use BlToolkit and want it to do not use parameters in final compiled query.

EXAMPLE: The query it compiles :

--  Sql MsSql2005
-- DECLARE @p1 Int64
-- SET @p1 = 101671702

SELECT * FROM dbo.Table1 WHERE Id = @p1

but I want it to compile like this:

--  Sql MsSql2005

SELECT * FROM dbo.Table1 WHERE Id = 101671702

Any idea?

John Smith
  • 1,783
  • 6
  • 22
  • 36

2 Answers2

0

BLToolkit only shows commented parameters when you get the compiled query through the debug info. If you open the SQL Server Profiler and see the query that is executing than these parameters are not there. So I think you're ok with the execution plan.

Mladen Macanović
  • 1,099
  • 7
  • 17
  • 1
    no it does not - in SQL profiler i get this (as part of a catched query) : OR [apbv].[Start] < atTo2 AND [apbv].[End] > atFrom2 - so I guess it uses parameters - by 'at' I mean @ – John Smith Mar 21 '14 at 13:46
0

if you know exactly what SQL to execute, you should use SetCommand and then execute the SQL directly, something like this :

using (var db = new DbManager("DemoConnection")){
    var data = db
        .SetCommand("SELECT * FROM dbo.Table1 WHERE Id = 101671702")
        .ExecuteList<Table1>();
}
andri
  • 1,021
  • 1
  • 9
  • 16