SQLCommand/SQLConnection 与 OleDbCommand/OleDbConnection

发布于 2024-08-22 06:28:28 字数 173 浏览 7 评论 0原文

我使用 SQLCommand/SQLConnection 而不是 OleDbCommand/OleDbConnection 有什么区别吗?从 API 舒适性、功能、性能或安全角度来看,我能从中获得任何优势吗?或者有其他的视角吗?

Does it make a difference whether I use SQLCommand/SQLConnection instead of OleDbCommand/OleDbConnection. Do I get any advantages out of that, from a API comfortability, feature, performance or security perspective? Or any other perspective?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

懒的傷心 2024-08-29 06:28:28

OleDbCommandOleDbConnection 是通用的。 SqlCommandSqlConnection 特定于 SQL Server,并且可以利用其功能。它们还公开了 SQL Server 的功能。例如,您可以使用它们来操作 XML 列。

OleDbCommand and OleDbConnection are general. SqlCommand and SqlConnection are specific to SQL Server, and can take advantage of its features. They also expose the features of SQL Server. For instance, you can use them to manipulate XML columns.

北座城市 2024-08-29 06:28:28

通过 sqlconnection,您可以使用事务和事务范围,例如:

using(var scope = new TransactionScope())
{

//do a lot of stuff with sqlconnection/sqlcommand (s)

scope.Complete()
}

您需要启用 msdtc 服务才能使其工作,

请查看此处 http: //valueinjecter.codeplex.com/,在数据访问层页面上我展示了这个

with sqlconnection you can use transactions and transaction scopes like:

using(var scope = new TransactionScope())
{

//do a lot of stuff with sqlconnection/sqlcommand (s)

scope.Complete()
}

you need to have the msdtc service enabled for this to work

look here http://valueinjecter.codeplex.com/, at the Data Access Layer page where I show this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文