正如我的图片中的ld_path里面的字符,把查询到的这个字符传递到我的函数中。我想知道需要什么查询函数实现。

解决方案 »

  1.   

    你后边需要一些逻辑来取出结果并释放它。
    result_ = mysql_store_result(mysql_); 
        while (row_ = mysql_fetch_row(result_)) 
        { 
            // get the field value 
            if (row_[0]) 
            { 
                std::cout<<"count = "<<row_[0]<<std::endl; 
                // convert it into int 
                cnt = atoi(row_[0]); 
                std::cout<<"cnt value = "<<row_[0]<<std::endl; 
            } 
        } 
        mysql_free_result(result_); 这里有一个更复杂的取多个结果集的例子:
    http://blog.csdn.net/iihero/article/details/8362269
      

  2.   

    MYSQL_RES *result;  
    MYSQL_ROW row;
    result = mysql_store_result(mysql);
    while((row = mysql_fetch_row(result))) //将查询出的结果存入相应对象中
    {
    strcpy(tabname, row[0]);        //若select出的是多个列,那就依次填上row[1],row[2]...
    }
    mysql_free_result(result);         //别忘了free