AddWithValue without DBType causing queries to run slowly

后端 未结 3 1143
眼角桃花
眼角桃花 2020-12-07 05:04

I\'ve been using cmd.Parameters.AddWithValue, and not specifying a DBType (int, varchar,...) to run queries. After looking at SQL Profiler, it seems that queries run with t

3条回答
  •  孤城傲影
    2020-12-07 05:24

    What is the SQL statement generated in both the cases?

    I am suspecting that it assumes the value as varchar when you don't explicitly specify it.

    e.g. SELECT OrderId FROM Orders WHERE OrderId = 1001
    vs SELECT OrderId FROM Orders WHERE OrderId = '1001'

提交回复
热议问题