热情软件屋

 

编译错误:error C2110:cannot add two pointers


编号:QA004311
建立日期: 2001年7月18日 最后修改日期:2001年7月18日
所属类别:

ken:
    i have a question:
    i have the following program in VC++6.0 ,using ADO:
     find("序号="+lRecNo+"",0,adSearchForward,"");
     //"lRecNo"is a long int varial that has been
    defined before//
    the VC++ said:error C2110:cannot add two pointers and i don't know what's the wrong,could u help me?
    the problem that bothers me is how to put a varial to the right of a SQL expression as below:
     RecordID=? //RecordID is a field name of a table//
    i'd like to listen to your opinions. thanx

回答:

    lRecNo是一个数字型变量,而"序号="是一个字符型变量,你不能直接将两种不同类型的变量相加。解决的办法是将lRecNo转换为字符型的,如:
    CString s;
    s.Format("序号=%d", lRecNo);
    find(s, ...);
    
    相关问题:
    QA003587 "如何进行CString变量和int变量的转换"

此问题由李海回答。

 
把这个问题推荐给朋友
   
   
您的意见类别
您的名字
您的电子邮件
您的建议(请尽可能详细)
 
 

版权所有 1997-2008 热情软件屋
如果您有任何建议和意见, 请给我发个电子邮件 askpro@china-askpro.com
Web Designed by ZebraStudio