select a.*,[b.name] as Name from Place a ,Area b where [a.AreaID]=[b.AreaID] and [b.AreaID] ='''+inttostr(NowAreaID)+''' order by a.PlaceID '''+inttostr(NowAreaID)+''' 是赋值的(SQL语句),老是数据类型不匹配,AreaID整型,NowAreaID也是整型该什么转换如果是字符型又如何转换?
如果你真的是在Delphi环境中,可以参考如下:
with adoqry do
begin
close;
sql.clear;
sql.add('select a.*,[b.name] as Name from Place a ,Area b where [a.AreaID]=[b.AreaID] and [b.AreaID] ='+inttostr(NowAreaID)+' order by a.PlaceID');
open;
end;
inttostr()是DELPHI的函数,在ACCESS中,直接用&.
try:
select a.*,[b.name] as Name from Place a ,Area b where [a.AreaID]=[b.AreaID] and [b.AreaID] =''& NowAreaID +'' order by a.PlaceID