当我去 MSDN SqlConnection
类的页面,它仅显示 C# 和 VB 中的示例。为什么 MSDN 不显示 C++ 示例?
我特别感兴趣的是 C++ 示例如何解决 C++ 中缺少 using
关键字的问题。
最佳答案
嗯……看完之后What is the Managed C++ equivalent to the C# using statement似乎相当于:
using (SqlConnection connection = new SqlConnection(connectionString))
{
// SqlCommand and so...
}
实际上是:
{
SqlConnection conn(connectionString);
// SqlCommand and so...
}
这令人印象深刻,因为 C++ 并不“缺少”using
语句,而是完全消除了对它的需要!我认为 C#/VB 程序员没有充分认识到 C++ 的优势(我当然没有 :)。
关于.net - 在 C++/.NET 中使用 SqlConnection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8036453/