SAS/BaseDAOImpl.cpp

22 lines
625 B
C++
Raw Permalink Normal View History

/*
* <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>ʵ<EFBFBD><EFBFBD>
*/
#include"BaseDAO.h"
_RecordsetPtr executeSql(_ConnectionPtr connection, const char* sql, vector<string>* v) {
if (v == NULL) {
return connection->Execute(sql, NULL, (long)0);
}
_CommandPtr command(__uuidof(Command));
command->ActiveConnection = connection;
command->CommandText = sql;
command->CommandType = adCmdText;
size_t size = v->size();
for (size_t i = 0; i < size; i++)
{
_ParameterPtr p = command->CreateParameter("var" + i, adVarChar, adParamInput, sizeof((*v)[i]), (*v)[i].c_str());
command->Parameters->Append(p);
}
return command->Execute(NULL, NULL, long(0));
}