MySqlCommand字符串变量参数不工作

MySqlCommand字符串变量参数不工作,mysql,string,Mysql,String,我正在构建一个函数来处理命令,但是MySQLCommand没有将我的字符串作为以下代码的参数,您能帮助我吗 int executeCommand(const std::string & mySqlCommand) { MySqlCommand ^ _cmdDataBased = gcnew MySqlCommand(mySqlCommand, _connDatabase); { try { _connDatabase->Op

我正在构建一个函数来处理命令,但是MySQLCommand没有将我的字符串作为以下代码的参数,您能帮助我吗

int executeCommand(const std::string & mySqlCommand)
{ 
    MySqlCommand ^ _cmdDataBased = gcnew MySqlCommand(mySqlCommand, _connDatabase);
    {
        try {
            _connDatabase->Open();
            _myReader = _cmdDataBase->ExecuteReader();    
            while (_myReader->Read()) {}
            return 1;
        }
        catch (Exception^ex) {
            //error management here please
            return 0;
        }
}
当我使用“command”而不是变量mySqlCommand时,错误会消失,但我想从函数的参数中获取命令。我已经多次尝试定义这个变量,System::String,char*,将其放在(“%s”,mySqlCommand)等…

解决了:

我需要对变量mySqlCommand使用System::String^type。我不是专家,只是在学习,我刚刚发现由于mySqlCommand是托管的,所以参数不能是本机std::string,如果我错了,请纠正我