vc2005 mfc 使用ado.net
2009-07-30 18:54
274 查看
#using <System.dll>
#using <system.data.dll>
using namespace System::Data::SqlClient;
using namespace System::Data;
SqlConnection^ connection;
SqlCommand^ command;
SqlDataReader^ reader;
SqlDataAdapter^ adapter;
DataSet^ customers;
connection=gcnew SqlConnection;
connection->ConnectionString="连接字串";
connection->Open ();
command=gcnew SqlCommand;
command->CommandText ="sql语句";
command->Connection =connection;
reader=command->ExecuteReader ();
if(reader->Read ()==false){
}
还要在项目属性中设置“公共语言运行时支持(/clr)”
#using <system.data.dll>
using namespace System::Data::SqlClient;
using namespace System::Data;
SqlConnection^ connection;
SqlCommand^ command;
SqlDataReader^ reader;
SqlDataAdapter^ adapter;
DataSet^ customers;
connection=gcnew SqlConnection;
connection->ConnectionString="连接字串";
connection->Open ();
command=gcnew SqlCommand;
command->CommandText ="sql语句";
command->Connection =connection;
reader=command->ExecuteReader ();
if(reader->Read ()==false){
}
还要在项目属性中设置“公共语言运行时支持(/clr)”
相关文章推荐
- 如何通过使用 ADO.NET 2005 和 Visual C# 2005 或使用 ADO.NET 和 Visual C# .NET 连接到数据库并运行命令
- 在vc中的MFC regular dll中使用ado的导入问题
- VB2005(1、使用ADO.NET访问数据库--Windows窗体中的数据体系结构)
- 在VC++.NET中使用ADO访问数据库
- VC++ MFC SQL ADO数据库访问技术使用的基本步骤及方法
- VC中使用ADO连接SQL 2005的一种方法
- VC++中使用MFC通过ADO连接数据库方法小结
- VC++中使用MFC通过ADO连接数据库
- VC++中使用MFC通过ADO连接数据库方法小结(不包括异常的捕捉
- Vc++(MFC)中使用ADO 连接SQL Server的(远程)
- VC++中使用MFC通过ADO连接数据库
- VC.NET + MFC 使用 GDI+ DrawLines 画线
- VC++ MFC SQL ADO数据库访问技术使用的基本步骤及方法
- 在MFC项目中使用ADO.NET
- VC++中使用MFC通过ADO连接数据库
- VC.Net定义和使用MFC DLL
- VC++.NET MFC的LIST CONTROL使用技巧1
- VC++ MFC SQL ADO数据库访问技术使用的基本步骤及方法
- 在VC++.NET中使用ADO访问数据库
- Vc++(MFC)中怎样使用ADO Data控件实现与SQL Server的(远程)连接(ADO实现)