c++ TADOConnection TADOQuery TDataSetProvider TClientDataSet 动态创建

TADOConnection *myADOConnection=new TADOConnection(NULL);
TADOQuery *myADOQuery=new TADOQuery(NULL);
TDataSetProvider *mDataSetProvider=new TDataSetProvider(NULL);
TClientDataSet *mClientDataSet=new TClientDataSet(NULL);
myADOQuery->Connection=myADOConnection;
mDataSetProvider->DataSet=myADOQuery;
mClientDataSet->ProviderName="mDataSetProvider";
mClientDataSet->SetProvider(mDataSetProvider);
myADOConnection->ConnectionString="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=用户名;Password=密码;Initial Catalog=数据库;Data Source=服务器";
myADOConnection->LoginPrompt=false;
myADOConnection->Open();
myADOQuery->SQL->Clear();
myADOQuery->SQL->Add("select * from tablename");
myADOQuery->Active=true;
mClientDataSet->Active=true;
String resultstr=mClientDataSet->XMLData;
myADOQuery->Active=false;
mClientDataSet->Active=false;

上一篇:【git】切换分支


下一篇:git操作-提交代码,解决冲突,常用命令,拉取、删除远程分支