int a1=2;b1=5;A=9;B=3;C=7;
mysql_query(conn,"select rt2 from tg2 where rt1 =a1*10000+b1*1000+A*100+B*10+C");运行时会出错:问题在rt1 =a1*10000+b1*1000+A*100+B*10+C请问怎么解决?谢谢!

解决方案 »

  1.   

    mysql_query(conn,"select rt2 from tg2 where rt1 ="+a1+"*10000+"+b1+"*1000+"+A
    +"*100+"+B+"*10+"+C); 
    用函数将数值->字符型
      

  2.   

    int t = a1*10000+b1*1000+A*100+B*10+C 
    mysql_query(conn,"select rt2 from tg2 where rt1 =" + t );
      

  3.   

    OR
    用变量赋值a1*10000+b1*1000+A*100+B*10+C
    将变量从数值->字符型
    mysql_query(conn,"select rt2 from tg2 where rt1 ="+变量)
      

  4.   

    我的代码是:
    mysql_query(conn,"select rt2 from tg2 where rt1 ==" + tt);
    res_set = mysql_store_result(conn);
    row=mysql_fetch_row(res_set);
    cout<<row[0]<<endl;
    还是有问题
      

  5.   

    怎样让mysql 的select 返回值直接就是数值型?