delphi字符串拼接
qry1.SQL.Add('insert into T_user (id,username,password,count) values ('+id+','''+name+''','''+pwd+''',0)');
id是int类型的,
name,pwd是字符串类型,
哪位大哥帮我看下
[解决办法]
IntToStr(id),用以用Quotedstr()函數處理單引號
qry1.SQL.Add('insert into T_user (id,username,password,count) values ('+IntToStr(id)+','+Quotedstr(name)+','+Quotedstr(pwd)+',0)');
[解决办法]
qry1.SQL.Add('insert into T_user (id,username,password,count) values ('+inttostr(id)+','#39+name+#39','#39+pwd+#39',0)');
遇见在字符串中 需要输入单引号,我喜欢用#39代替
[解决办法]
用Quotedstr()函数,最好