| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 816 人关注过本帖
标题:截断字符串错误,如图,紧急求助!
只看楼主 加入收藏
unseenkiller
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-5-20
收藏
 问题点数:0 回复次数:4 
截断字符串错误,如图,紧急求助!

图片附件: 游客没有浏览图片的权限,请 登录注册

如图所示:什么原因呢?????????

var
zhengchang,gaodu,ribian,zgaizheng,ggaizheng :real;

begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 水平梯度 from CTABLE where 编号=');
adoquery1.SQL.add(':ss');
adoquery1.Parameters.ParamByName('ss').Value:=trim(edit1.text);
adoquery1.Open;
zhengchang:=adoquery1.FieldByName('水平梯度').AsFloat;

adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 垂直梯度 from CTABLE where 编号=');
adoquery1.SQL.add(':ss');
adoquery1.Parameters.ParamByName('ss').Value:=trim(edit1.text);
adoquery1.Open;
gaodu:=adoquery1.FieldByName('垂直梯度').AsFloat;


adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 日变改正 from CTABLE where 编号=');
adoquery1.SQL.add(':ss');
adoquery1.Parameters.ParamByName('ss').Value:=trim(edit1.text);
adoquery1.Open;
ribian:=adoquery1.FieldByName('日变改正').AsFloat;

ggaizheng:=strtofloat(edit5.text)*gaodu;

adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into CTABLE1 values(:a,:b,:c,:d,:e,:f,:g,:h,:i,:j,:k,:l)');
adoquery1.Parameters.ParamByName('a').Value:=trim(edit1.text);
adoquery1.Parameters.ParamByName('b').Value:=trim(edit2.text);
adoquery1.Parameters.ParamByName('c').Value:=trim(edit3.text);
adoquery1.Parameters.ParamByName('d').Value:=strtofloat(edit4.text);
adoquery1.Parameters.ParamByName('e').Value:=strtofloat(edit5.text);
adoquery1.Parameters.ParamByName('f').Value:=trim('combobox1.Text'+'combobox2.text'+'combobox3.text');
adoquery1.Parameters.ParamByName('g').Value:=strtofloat(edit6.text);
adoquery1.Parameters.ParamByName('h').Value:=strtofloat(edit7.text);
adoquery1.Parameters.ParamByName('i').Value:=strtofloat(edit3.text)*zhengchang;
adoquery1.Parameters.ParamByName('j').Value:=ribian;
adoquery1.Parameters.ParamByName('k').Value:=ggaizheng;
adoquery1.Parameters.ParamByName('l').Value:=strtofloat(edit7.text)+zgaizheng+ggaizheng+ribian;
adoquery1.ExecSQL;

end;

搜索更多相关主题的帖子: 字符 截断 
2007-05-22 16:04
unseenkiller
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-5-20
收藏
得分:0 

不胜感激!!!!!!!!!!!!


自由自思想,独立之精神!!
2007-05-22 16:05
phonbob
Rank: 1
等 级:新手上路
威 望:1
帖 子:57
专家分:0
注 册:2007-4-21
收藏
得分:0 
ggaizheng:=strtofloat(edit5.text)*gaodu;
出错行是这里吗?

男儿、血如泪、洒沙场
2007-05-23 09:51
unseenkiller
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-5-20
收藏
得分:0 
以下是引用phonbob在2007-5-23 9:51:14的发言:
ggaizheng:=strtofloat(edit5.text)*gaodu;
出错行是这里吗?

谢谢,问题已经解决了,不过不是那里.

trim('combobox1.text'+'trim(combobox2.text)'+trim(combobox3.text)')的错误原因.


自由自思想,独立之精神!!
2007-05-23 22:07
volte
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:69
帖 子:1167
专家分:1316
注 册:2004-12-19
收藏
得分:0 

两中解决方案,
要么数据库表中插入的字符字段过短,加长
要么注意插入的字符字段不要超过数据库中匹配的字段长度。


大家都是朋友,有空就来坐坐!
2007-05-24 09:15
快速回复:截断字符串错误,如图,紧急求助!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029455 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved