| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1790 人关注过本帖
标题:[求助] 关于adoquery not found 的错误,谢谢了
只看楼主 加入收藏
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
 问题点数:0 回复次数:9 
[求助] 关于adoquery not found 的错误,谢谢了

一个好麻烦的问题大家帮忙我看一下,在我添加下列程序:
if editID_CQ.Text=adoqueryCQ.FieldByName('cqkhid').AsString then showmessage('该卡已注册')
else if editCKH_CQ.Text=adoqueryCQ.FieldByName('cqckh').AsString then begin
if MessageDlg('确定要覆盖?',mtConfirmation,[mbYes,mbNO],1)=mrYes then begin
adoqueryCQ.SQL.Clear;
adoqueryCQ.SQL.Add('Update 长期客户管理 set cqkhid=:a,cqkhxm=:b,cqcph=:c,cqckh=:d,cqckqx=:e,cqkhzz=:f,cqtel=:g,cqvalue=:h,cqtype=:i,cqbkh=:j,cqrktime=:k,cqcktime=:l');
adoqueryCQ.Parameters.ParamByName('a').Value:=editID_CQ.Text;
adoqueryCQ.Parameters.ParamByName('b').Value:=editNAME_CQ.Text;
adoqueryCQ.Parameters.ParamByName('c').Value:=editCPH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('d').Value:=editCKH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('e').Value:=editCKQX_CQ.Text;
adoqueryCQ.Parameters.ParamByName('f').Value:=editADDRESS_CQ.Text;
adoqueryCQ.Parameters.ParamByName('g').Value:=editTEL_CQ.Text;
adoqueryCQ.Parameters.ParamByName('h').Value:=editVALUE_CQ.Text;
adoqueryCQ.Parameters.ParamByName('i').Value:=comboboxCQ.Text;
adoqueryCQ.Parameters.ParamByName('j').Value:=editBKH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('k').Value:=DateTimePicker1.DateTime;
adoqueryCQ.Parameters.ParamByName('l').Value:=editCKTIME_CQ.Text ;
adoqueryCQ.ExecSQL;
end;
end
之前程序可以顺利运行,但是当我添加了这两个判断之后,只要是输入和数据库中ID号或CKH车库号相同的信息,就会出现以下这个adoquery的错误,而且错误信息的提示行是表示在ADOQueryCQAfterScroll的第一句EditID_CQ.Text:=adoqueryCQ.FieldByName('ID').AsString;有错误,为什么啊??
知道这段代码比较长,所以很谢谢可以帮助我看看的朋友们

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


procedure TMessageDesignForm.ADOQueryCQAfterScroll(DataSet: TDataSet);
begin
EditID_CQ.Text:=adoqueryCQ.FieldByName('ID').AsString;
EditNAME_CQ.Text:=adoqueryCQ.FieldByName('姓名').AsString;
EditADDRESS_CQ.Text:=adoqueryCQ.FieldByName('住址').AsString;
EditTEL_CQ.Text:=adoqueryCQ.FieldByName('电话').AsString;
EditCKH_CQ.Text:=adoqueryCQ.FieldByName('车库号').AsString;
EditCPH_CQ.Text:=adoqueryCQ.FieldByName('车牌号').AsString;
EditBKH_CQ.Text:=adoqueryCQ.FieldByName('补卡号').AsString;
EditCKQX_CQ.Text:=adoqueryCQ.FieldByName('持卡期限').AsString;
EditVALUE_CQ.Text:=adoqueryCQ.FieldByName('费用').AsString;
DateTimePicker1.Date:=strtodate(adoqueryCQ.FieldByName('入库时间').AsString);
EditCKTIME_CQ.Text:=adoqueryCQ.FieldByName('出库时间').AsString;
end;



procedure TMessageDesignForm.ButtonSAVE_CQClick(Sender: TObject);
begin
if…… then showmessage('请将信息填写完整')
else begin
adoqueryCQ.SQL.Clear;
adoqueryCQ.SQL.Add('select * from 长期客户管理');
adoqueryCQ.Open;

if editID_CQ.Text=adoqueryCQ.FieldByName('cqkhid').AsString then showmessage('该卡已注册')
else if editCKH_CQ.Text=adoqueryCQ.FieldByName('cqckh').AsString then begin
if MessageDlg('确定要覆盖?',mtConfirmation,[mbYes,mbNO],1)=mrYes then begin
adoqueryCQ.SQL.Clear;
adoqueryCQ.SQL.Add('Update 长期客户管理 set cqkhid=:a,cqkhxm=:b,cqcph=:c,cqckh=:d,cqckqx=:e,cqkhzz=:f,cqtel=:g,cqvalue=:h,cqtype=:i,cqbkh=:j,cqrktime=:k,cqcktime=:l');
adoqueryCQ.Parameters.ParamByName('a').Value:=editID_CQ.Text;
adoqueryCQ.Parameters.ParamByName('b').Value:=editNAME_CQ.Text;
adoqueryCQ.Parameters.ParamByName('c').Value:=editCPH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('d').Value:=editCKH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('e').Value:=editCKQX_CQ.Text;
adoqueryCQ.Parameters.ParamByName('f').Value:=editADDRESS_CQ.Text;
adoqueryCQ.Parameters.ParamByName('g').Value:=editTEL_CQ.Text;
adoqueryCQ.Parameters.ParamByName('h').Value:=editVALUE_CQ.Text;
adoqueryCQ.Parameters.ParamByName('i').Value:=comboboxCQ.Text;
adoqueryCQ.Parameters.ParamByName('j').Value:=editBKH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('k').Value:=DateTimePicker1.DateTime;
adoqueryCQ.Parameters.ParamByName('l').Value:=editCKTIME_CQ.Text ;
adoqueryCQ.ExecSQL;
end;
end
else begin
adoqueryCQ.SQL.Clear;
adoqueryCQ.SQL.Text:='Insert into 长期客户管理(cqkhid,cqkhxm,cqcph,cqckh,cqckqx,cqkhzz,cqtel,cqvalue,cqtype,cqbkh,cqrktime,cqcktime) values('''+editID_CQ.Text+''','''+editNAME_CQ.Text+''','''+editCPH_CQ.Text+''','''+editCKH_CQ.Text+''','''+editCKQX_CQ.Text+''','''+editADDRESS_CQ.Text+''','''+editTEL_CQ.Text+''','''+editVALUE_CQ.Text+''','''+ComboboxCQ.Text+''','''+editBKH_CQ.Text+''','''+datetostr(DateTimePicker1.Date)+''','''+EditCKTIME_CQ.Text+''')';
try
adoqueryCQ.ExecSQL;
except
showmessage('保存失败,请检查数据库!');
exit;
end;
showmessage('保存成功');
ShowDataForCQ;
SetState(vShow);
end;
end;
end;


搜索更多相关主题的帖子: found SQL adoquery not begin 
2007-04-15 15:05
红枫林
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2007-3-29
收藏
得分:0 

我也是新手,这是我的看法,你参考一下吧,我觉得是你的if判断不正确,你没有做循环,应该是和整个表里的id比较的,应该从first开始,然后while not eof,还要next


2007-04-15 15:19
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
得分:0 
哦,嗯,我再试试看,谢谢先

2007-04-15 15:36
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
得分:0 

判断first合eof的时候,这样写对吗?
adoquery1.sql.close;
adoquery1.sql.add('select * from ***表');
adoquery1.first;
adoquery1.append;
adoquery1.open;
while not eof do
begin
if(editCKH_CQ.TEXT=adoquery1.fieldbyname('ckh').asstring) then....
end;


2007-04-15 16:11
zhongjinting
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-4-14
收藏
得分:0 
while not adoqury1.eof do
2007-04-15 19:04
sgliuxiu
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:291
专家分:0
注 册:2007-2-2
收藏
得分:0 

这是从你的那里提取出来的
adoqueryCQ.SQL.Clear;
adoqueryCQ.SQL.Add('select * from 长期客户管理');
adoqueryCQ.Open;

if editID_CQ.Text=adoqueryCQ.FieldByName('cqkhid').AsString then showmessage('该卡已注册')


你上面是从那数据表里提取所有记录,而下面判断的是什么?是一直同一个记录比较吗?


小猫说:给我10元钱
2007-04-16 09:54
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
得分:0 
嗯,谢谢,我改改后试试看

2007-04-16 10:01
nongen
Rank: 5Rank: 5
来 自:网络
等 级:贵宾
威 望:17
帖 子:322
专家分:0
注 册:2006-11-25
收藏
得分:0 
循环要加.next

昨天不是我的,明天不是你的,今天却是我们的。
http://www.
2007-04-16 20:17
aaron52088
Rank: 1
等 级:新手上路
帖 子:130
专家分:0
注 册:2007-1-24
收藏
得分:0 
adoqueryCQ.SQL.Clear;
adoqueryCQ.SQL.Text:='select * from 长期客户管理';
adoqueryCQ.Open;
adoqueryCQ.First; //我加了从第一行开始判断的,不知道有没有错,还是会出现图片上的错误呀,help and 3q
while not adoqueryCQ.Eof do
begin
if EditCKH_CQ.Text=adoqueryCQ.FieldByName('cqckh').AsString then begin
if MessageDlg('信息已存在,是否要覆盖',mtConfirmation,[mbYes,mbNO],1)=mrYes then
begin
adoqueryCQ.Close;
adoqueryCQ.SQL.Clear;
adoqueryCQ.SQL.Text:='Update 长期客户管理 set cqkhid=:a,cqkhxm=:b,cqcph=:c,cqckh=:d,cqckqx=:e,cqkhzz=:f,cqtel=:g,cqvalue=:h,cqtype=:i,cqbkh=:j,cqrktime=:k,cqcktime=:l where cqckh=:cqckh';
adoqueryCQ.Parameters.ParamByName('cqckh').Value:=editCKH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('a').Value:=editID_CQ.Text;
adoqueryCQ.Parameters.ParamByName('b').Value:=editNAME_CQ.Text;
adoqueryCQ.Parameters.ParamByName('c').Value:=editCPH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('d').Value:=editCKH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('e').Value:=editCKQX_CQ.Text;
adoqueryCQ.Parameters.ParamByName('f').Value:=editADDRESS_CQ.Text;
adoqueryCQ.Parameters.ParamByName('g').Value:=editTEL_CQ.Text;
adoqueryCQ.Parameters.ParamByName('h').Value:=strtoint(editVALUE_CQ.Text);
adoqueryCQ.Parameters.ParamByName('i').Value:=comboboxCQ.Text;
adoqueryCQ.Parameters.ParamByName('j').Value:=editBKH_CQ.Text;
adoqueryCQ.Parameters.ParamByName('k').Value:=DateTimePicker1.DateTime;
adoqueryCQ.Parameters.ParamByName('l').Value:=editCKTIME_CQ.Text;
try
adoqueryCQ.ExecSQL;
except
showmessage('数据库连接异常,请重试!');
exit;
end;

2007-04-23 13:08
sgliuxiu
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:291
专家分:0
注 册:2007-2-2
收藏
得分:0 
你加了第一行没错,但永远是在第一行,没见你里面有next......

小猫说:给我10元钱
2007-04-23 23:35
快速回复:[求助] 关于adoquery not found 的错误,谢谢了
数据加载中...
 
   



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

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