ADO.NET 和 SQL Server 存储过程 - INSERT、UPDATE、DELETE 之后的 SELECT
在依赖 SQL Server 存储过程和经典 ADO.NET(DataSet、DataAdapter)的大型项目中,INSERT、DELETE 和 UPDATE 过程之后有一个 SELECT。在代码中,所有方法都返回 void,这与 SELECT 有何关联 - 有什么作用? SELECT 对性能有什么影响?
In a large project relying on SQL Server stored procedures and classic ADO.NET (DataSets, DataAdapters) after INSERT, DELETE and UPDATE procedures there is a SELECT following. In code, all the methods return void, is this SELECT of any relevance - what effect does in have? What is the performance impact of the SELECT?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的方法不返回任何内容,则这些选择是无用的,除非其他应用程序出于未知原因使用它们。
If your method doesn't return anything those selects are useless, unless some other application uses them for unknown reasons.
当手动运行存储过程或调试时,它将帮助数据库开发人员/支持人员。我经常使用这种类型的东西(与事务结束时的回滚结合使用)来在提交之前验证输出。下次查看时更容易将其放在那里,而不必重新发明它。您可以将其注释掉,但这不会造成任何伤害。
毕竟,其他东西可能正在使用该存储过程并且不返回void。
It would help the database developer/support when running the stored procedure manually or in debug. I will often use this type of thing (in conjunction with a rollback at the end of a transaction) to validate the output before committing. Easier to have it there for next time you're reviewing it, rather than having to reinvent it. You could comment it out, but it's not hurting anything.
After all, something else could be using that stored procedure and not returning void.