如题,我用MYSQL从数据库里取出了所有的数据,但是想把数据显示到界面上,不知道该怎样定位到某一行某一列,请各位高手帮帮忙了,谢谢

解决方案 »

  1.   

    直接用jdbc的话,就用resultSet结果集去数据,rs第一次指向数据索引,rs.next()是第一行,然后列可以想map一样取值,例如getString(“name”);
      

  2.   

    我用的是MYSQL提供的C API 函数
      

  3.   

    mysql_fetch_row可以取到某一行,但怎样取到某一列呢,又怎样判断这一列的数据类开呢,因为我要显示在CListCtrl中,要是LPCTSTR,也就是字符串的类型
      

  4.   

    手册中的例子,如何通过row[i]到是例的值。MYSQL_ROW row;
    unsigned int num_fields;
    unsigned int i;num_fields = mysql_num_fields(result);
    while ((row = mysql_fetch_row(result)))
    {
       unsigned long *lengths;
       lengths = mysql_fetch_lengths(result);
       for(i = 0; i < num_fields; i++)
       {
           printf("[%.*s] ", (int) lengths[i], 
                  row[i] ? row[i] : "NULL");
       }
       printf("\n");
    }
      

  5.   

    MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html这是官网的地址,你自己google 一下 mysql.com 就可以找到它的官网了。不过C API的介绍,你需要到英文版中去找。