其他不是字符串的,就用CString::Format(...)格式化成需要各格式就是了。

解决方案 »

  1.   

    你可以用CString的Format()试一试,
    如不行你用ado 的转换
      

  2.   

    我的意思是是要将CString型的数据,变成其它类型写入数据库。
      

  3.   

    你的写法有问题吗?我也是那样写的,CString、int、float都可以用单引号括起来。说说你的出错信息是什么?
      

  4.   

    因为SqlCommand本身就是CString,是不是就不能用非CString呀?
    strSqlCommand += "'" + xxx + "'" + ",";有没有其他的写法?让xxx是int型呀?
      

  5.   

    用case 语句吧不是cstring类型用CString::Format(...)
    的转换一下不久行了?,
      

  6.   

    int id =1;
    char name="fdfdfdf";sql.Format("insert into t1 (id, name) values (%d, '%s'", id, name));
      

  7.   

    up
    日期型可以这样:str.Format("... %s-%s-%s...",CurYear,CurMonth,CurDay);