sql语句的小问题(100分)

Z

zeng_xh

Unregistered / Unconfirmed
GUEST, unregistred user!
Parameters.ParamByName('stra').Value:=stra;

这个stra的数值为='进货入库'
执行完成后 数据库就只能看到'进货' 数据库字段为 varchar(40)

请问这是为什么?
 
你在程序中添加了静态字段,并且 stra 字段大小为4,将大小改为40 即可。
 
我没有啊
stra:string;

SQL.Add('insert into store_items(goods_id,goods_name,quantity,unit,bill_id,in_method)');
sql.Add('select goods_id,goods_name,quantity,unit,bill_id,:stra from goods_in_items');
Parameters.ParamByName('stra').Value:=stra;

问题是不是因为我的表goods_in_items 中不含in_method字段
 
可能是你原来的长度定义为4,后来改为40。在当前的字段中的SIZE还是4
 
TO:xsqxsq111
关键是该怎么办呀?
 
点中这个静太字段,找到FieldSize属性。
 
TO:caidao 这是个定义的变量,我是用sql写到数据库中去的呀
 
SQL.Add('insert into store_items(goods_id,goods_name,quantity,unit,bill_id,in_method)');
sql.Add('select goods_id,goods_name,quantity,unit,bill_id, '+QuotedStr(stra)+' from goods_in_items');
如果还不对,就是变量stra的问题
 
smallbs,谢谢! 搞定了
 
顶部