Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 AJAX 和 JSON 调用做更多工作,我注意到 SqlCommand 对象有两个方法,ExecuteNonQuery() 和 ExecuteNonQueryAsync(),这些方法到底有什么区别?
如果您调用ExecuteNonQuery您的代码将等到它完成。如果您调用您的代码将继续执行,您可以通过它返回ExecuteNonQueryAsync的对象跟踪实际调用何时ExecuteNonQueryAsync完成。Task<int>
ExecuteNonQuery
ExecuteNonQueryAsync
Task<int>