超难解决的逻辑错误问题? 急急急
2008-12-11 09:51
225 查看
超难解决的逻辑错误问题? 急急急 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiDB/html/delphi_20061222173752156.html
我的程序面板上放有:DBGrid,AdoQuery等,还有“下一条记录”,“上一条记录”,“删除当前记录”等按扭,程序启动时DBGrid为空,此时点击上面任何一按扭,程序报错退出。
以“删除”按纽为例,我的程序如下:
procedure TForm1.Button5Click(Sender: TObject);
begin
adoquery1.open;
if adoquery1.RecordCount=0 then
MessageBox(0,'SetCommMask Error !','Notice',MB_OK)
else
if Application.MessageBox('是否删除当前记录?','提示',mb_yesno)=id_yes then
ADOQuery1.Delete;
end;
为了执行是否adoquery1.RecordCount=0,必须adoquery1.open,但是当 adoquery1.RecordCount=0时,Adoquery1.SQL.Text:=''此时就不能和数据库想连,当然就不能去计算Recordcount,想了一天了,脑袋都大了,哪位大哥帮帮我啊,感激涕零。
如果问题没搞清,QQ:110546987在线等到,bearzmc@163.com.谢谢
没看明白说得是什么?
procedure TForm1.Button5Click(Sender: TObject);
begin
adoquery1.close;
adoquery1.sql.clear;
adoquery1.add('select * from table where .....');
adoquery1.open;
if adoquery1.RecordCount=0 then
MessageBox(0,'SetCommMask Error !','Notice',MB_OK)
else
if Application.MessageBox('是否删除当前记录?','提示',mb_yesno)=id_yes then
begin
ADOQuery1.close;
ADOQuery1.sql.clear;
ADOQuery1.sql.add('delete table where ....');
ADOQuery1.execsql;
end;
end;
http://www.delphi2007.net/DelphiDB/html/delphi_20061222173752156.html
我的程序面板上放有:DBGrid,AdoQuery等,还有“下一条记录”,“上一条记录”,“删除当前记录”等按扭,程序启动时DBGrid为空,此时点击上面任何一按扭,程序报错退出。
以“删除”按纽为例,我的程序如下:
procedure TForm1.Button5Click(Sender: TObject);
begin
adoquery1.open;
if adoquery1.RecordCount=0 then
MessageBox(0,'SetCommMask Error !','Notice',MB_OK)
else
if Application.MessageBox('是否删除当前记录?','提示',mb_yesno)=id_yes then
ADOQuery1.Delete;
end;
为了执行是否adoquery1.RecordCount=0,必须adoquery1.open,但是当 adoquery1.RecordCount=0时,Adoquery1.SQL.Text:=''此时就不能和数据库想连,当然就不能去计算Recordcount,想了一天了,脑袋都大了,哪位大哥帮帮我啊,感激涕零。
如果问题没搞清,QQ:110546987在线等到,bearzmc@163.com.谢谢
没看明白说得是什么?
procedure TForm1.Button5Click(Sender: TObject);
begin
adoquery1.close;
adoquery1.sql.clear;
adoquery1.add('select * from table where .....');
adoquery1.open;
if adoquery1.RecordCount=0 then
MessageBox(0,'SetCommMask Error !','Notice',MB_OK)
else
if Application.MessageBox('是否删除当前记录?','提示',mb_yesno)=id_yes then
begin
ADOQuery1.close;
ADOQuery1.sql.clear;
ADOQuery1.sql.add('delete table where ....');
ADOQuery1.execsql;
end;
end;
相关文章推荐
- 将tempdb从master设备中转移时出现逻辑页面读取错误问题的解决
- siglow 造成的网卡驱动问题及驱动更新错误解决
- Cadence Allegro导网表的错误问题解决
- myeclipse不能编译、有错误不提示问题解决
- 《金子塔原理》读书笔记之解决问题的逻辑
- 在 Ubuntu 7.04 上安装 VirtualBox 可能会遇到的错误问题的解决!
- JsonFormat注解转换时间错误问题解决方案
- 即兴知识点-3 myeclipse中,项目上有个叉报错,文件没有错误,或者没有jre包 解决那别发 注释乱码问题
- Thread问题:解决 java.lang.IllegalThreadStateException: Thread already started. 错误
- E/JavaBinder:FAILED BINDER TRANSACTION错误解决+RadioGroup调用check方法的时候,onCheckedChanged被调用多次的问题解决
- 如何解决Ubuntu deb版本错误导致的问题
- 【解决】SQL Server 检测到基于一致性的逻辑 I/O 错误
- 解决Chrome 以下插件已崩溃:shockwave flash错误提示的问题
- 解决卸载或者安装程序失败的问题,提示:错误 1402。无法打开键UNKNOWN\Components\xxx
- Ubuntu常见错误问题解决
- 解决卸载或者安装程序失败的问题,提示:错误 1402。无法打开键UNKNOWN\Components\xxx
- 解决springmvc关于前台日期作为实体类对象参数类型转换错误的问题
- 解决在Windows和Windows Server的应用程序日志中记录了”事件ID 4107”或”事件ID 11”错误问题
- c#中WebClient类的DownloadData方法出现的“500内部服务器错误”问题及解决