在.Net Framework 2.0中SqlClient增加了AddWithValue(string parameterName, object value)方法。 该方法简化了调用储存过程的输入参数过程,在运行时对所输入的数据类型进行判断,获取对应的数据库类型。因此该方法在运行效率上比用Add(string parameterName, SqlDbType sqlDbType, int size, string sourceColumn)方法要低。在效率要求较高的地方仍然建议使用Add()方法,其它场合可以使用AddWithValue()简化代码编写量。 相关文章: