0

I've been trying to use DbExtensions.SqlBuilder and have encountered a strange behaviour similar to the one in this question

Basically when I do

var query = SQL
   .SELECT("ID")
   .FROM("TABLE")
   .WHERE("Column1 = {0}", 1);

Rather than getting the raw sql to be

SELECT ID FROM TABLE WHERE Column1 = 1

I get the following instead:

SELECT ID FROM TABLE WHERE Column1 = {0}

Which doesn't seem right. Even the answer to the question I referenced doesn't seem to make sense to me. Why is the WHERE clause not formatting the string correctly?

Thanks

Kakalokia
  • 3,191
  • 3
  • 24
  • 42
  • I suggest you do some research on why use **parameterized SQL**. – Max Toro Dec 15 '17 at 15:37
  • @MaxToro ... I did all the research I could carry out and did not find anything useful. If you are aware of some page that explains why the example I provided in this question behaves the way it does, then that would be useful. – Kakalokia Dec 15 '17 at 17:08
  • Possible duplicate of [Get raw sql statement with DbExtensions SqlBuilder](https://stackoverflow.com/questions/27187755/get-raw-sql-statement-with-dbextensions-sqlbuilder) – Smith May 07 '19 at 12:01

0 Answers0