您的位置:首页 > 其它

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)”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: