How do you specify 'DEFAULT' as a SQL parameter value in ADO.NET?

前端 未结 5 2331
礼貌的吻别
礼貌的吻别 2020-12-10 12:08

I have a parameterized SQL query targetted for SQL2005 which is dynamically created in code, so I used the ADO.NET SqlParameter class to add sql parameters to <

5条回答
  •  离开以前
    2020-12-10 12:22

    SQL query parameters take the place of literal values only.

    You can't send an SQL keyword as the value of a parameter, just as you cannot send a table identifier, column identifier, list of values (e.g. for an IN predicate), or an expression. The value of the parameter is always interpreted as a literal value, as if you had included a quoted string literal or a numeric literal in your query.

    Sorry, but you have to include an SQL keyword as part of the SQL query before you prepare that query.

提交回复
热议问题