在.Net Framework 2.0中SqlClient增加了AddWithValue(string parameterName, object value)方法。

该方法简化了调用储存过程的输入参数过程,在运行时对所输入的数据类型进行判断,获取对应的数据库类型。

因此该方法在运行效率上比用
Add(string parameterName, SqlDbType sqlDbType, int size, string sourceColumn)
方法要低。

在效率要求较高的地方仍然建议使用Add()方法,其它场合可以使用AddWithValue()简化代码编写量。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2021-10-26
猜你喜欢
  • 2021-10-14
  • 2022-12-23
  • 2021-07-31
  • 2021-10-18
  • 2021-12-04
相关资源
相似解决方案