delphi中删除一条Access数据
下面的代码运行时,出现错误:
'update tmh set dtmh='''+trim(Edit16.Text)+''' where id=''+did+'''
报错如下:
提示:Project P_Tcb.exe raise exception class EOLeException with message'标准表达式中数据类型不匹配。'.Precess stopped.Use Step or Run to continue
id是整数类型
其他方面都能正常运行
有楼主回复用where id='+did
delphi无法编译,提示如下:
[Error] U_txmdy.pas(546): Incompatible types: 'String' and 'Integer'
同样,语句sql.Add('update tmh set dtmh='''+trim(Edit16.Text)+''' where id='+did+'');在编译时也有以上提示
[解决办法]
id是整数类型,那did是什麼類型?
整型:id='+IntToStr(did)
字符型:id='+did
[解决办法]
我靠,分还是要靠我来拿,呵呵
'update tmh set dtmh='''+trim(Edit16.Text)+''' where [id]='+did