sprintf(buf,"select * from 学生总表 where 系别 like \'%s%s%s\'","%",str.GetBuffer(str.GetLength()),"%");
//sprintf(buf,"select * from 学生总表 where 年级 like \'*%s*\'",str.GetBuffer(str.GetLength()));
为什么下面一个是不正确的阿,那个%怎么用在那边,有点想不通!
还有:ttemp.Format(" %02X",(BYTE)str[i]);02x是什么意思!
谢谢了!

解决方案 »

  1.   

    wsprintf(buf,"SELECT * FROM 学生总表 WHERE 系别 LIKE '%%%S%%'" str.GetBuffer(str.GetLength());如果使用的是NVARCHAR 类型的话,则wsprintf(buf,"SELECT * FROM 学生总表 WHERE 系别 LIKE N'%%%S%%'" str.GetBuffer(str.GetLength());
      

  2.   

    ttemp.Format(" %02X",(BYTE)str[i]);02x是什么意思!=----------------------------------------
    02x表示显示两位,不足前面补零
    例如 上面如果i=1,则ttemp=01
    如果i=12,则ttemp=12
      

  3.   

    02X,表示用16进制显示,如 
    tmp = "\n";
    ddd = tmp.Format( "%02X", tmp );则ddd = 0x0A;
      

  4.   

    其实"like,%"就和DOS命令中的"*"的功能差不多。