求解一个adoquery的语句,我初学不懂,大家教教我。

zly22169846 2005-03-28 09:49:20
procedure TForm1.Timer1Timer(Sender: TObject);
begin
with ADQ do
begin
sql.Clear;
sql.Add('select Mobile,Big_Number,ServiceCode from xb_command_send where state=1');
open;
if ADQ .RecordCount>0 then
begin
Smobile:=adq.FieldValues['Mobile'] ;
Sbig_number:=adq.FieldValues['Big_Number'];
SServiceCode:=adq.FieldValues['ServiceCode'];
sql.Clear;
sql.Add('update XB_Command_Send state=0 where mobile='''+SMobile+'''');
ADQ .ExecSQL;
end
else
sql.Clear;
end;
end;
在时钟下有这么一个过程,但是这样肯定不好的,我想用
temsql='select Mobile,Big_Number,ServiceCode from xb_command_send where state=1'
adq......(不懂怎么写)
while not ... do
begin

next
end
这个怎么用?能不能帮我改改啊,
...全文
150 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
zly22169846 2005-03-28
  • 打赏
  • 举报
回复
都没有人回答啊,晕哦。哎!
zly22169846 2005-03-28
  • 打赏
  • 举报
回复
上面帖错了。
with ADQ do
begin
sql.Clear;
sql.Add('select Mobile,Big_Number,ServiceCode from xb_command_send where state=1');
open;

while not adq.Eof
begin
Smobile:=adq.FieldValues['Mobile'] ;
Sbig_number:=adq.FieldValues['Big_Number'];
SServiceCode:=adq.FieldValues['ServiceCode'];
sql.Clear;
sql.Add('update XB_Command_Send state=0 where mobile='''+SMobile+'''');
adq.ExecSQL;
adq.Next;
end
zly22169846 2005-03-28
  • 打赏
  • 举报
回复
你们看我这样子写对不对,我猜肯定不对,你们能不能帮我写出来啊。跪求了。

procedure TForm1.Timer1Timer(Sender: TObject);
begin
with ADQ do
begin
sql.Clear;
sql.Add('select Mobile,Big_Number,ServiceCode from xb_command_send where state=1');
open;
with ADQ do
begin
sql.Clear;
sql.Add('select Mobile,Big_Number,ServiceCode from xb_command_send where state=1');
open;
while not adq.Eof
begin
Smobile:=adq.FieldValues['Mobile'] ;
Sbig_number:=adq.FieldValues['Big_Number'];
SServiceCode:=adq.FieldValues['ServiceCode'];
sql.Clear;
sql.Add('update XB_Command_Send state=0 where mobile='''+SMobile+'''');
adq.ExecSQL;
adq.Next;
end
sql.Clear;
end;
end;
darkie28 2005-03-28
  • 打赏
  • 举报
回复
一般是 while not 数据集.eof do
begin
.
.
.
next;
end;
XINGXIMU 2005-03-28
  • 打赏
  • 举报
回复
为什么要用时钟?你想实现什么?用时钟不断的处理数据库资源耗损较大
nytony 2005-03-28
  • 打赏
  • 举报
回复
while 数据集.eof do
数据集可为table或query
zly22169846 2005-03-28
  • 打赏
  • 举报
回复

前面是不是要个tempsql='语句',然后我就不知道了??
while not 什么东西呢? do
begin


这里好像还要个ADQ什么的next吧。不在清楚?
end
ln521 2005-03-28
  • 打赏
  • 举报
回复
while not .. do //当数据不为空的时候 -->往下
begin
//你想要的东西
end
zly22169846 2005-03-28
  • 打赏
  • 举报
回复
就是用while not .. do
begin

end  语句来查询数据库啊,我不懂这个句子的语法。
ln521 2005-03-28
  • 打赏
  • 举报
回复
adoquery.close;
adoquery.sql.clear;
adoquery.sql.add(temsql);
while not adoquery.eof do
begin

next
end
liangyong007a 2005-03-28
  • 打赏
  • 举报
回复
你想干嘛?
darkie28 2005-03-28
  • 打赏
  • 举报
回复
这句好象漏了set,
sql.Add('update XB_Command_Send state=0 where mobile='''+SMobile+'''');
应该是sql.Add('update XB_Command_Send set state=0 where mobile='''+SMobile+'''');
darkie28 2005-03-28
  • 打赏
  • 举报
回复
你写的没错,不过如果你的adq.connection事先没写清,是动态的,那就要在clear之前加上adq.connection:=.....
【SCI复现】含可再生能源与储能的区域微电网最优运行:应对不确定性的解鲁棒性与非预见性研究(Matlab代码实现)内容概要:本文围绕含可再生能源与储能的区域微电网最优运行展开研究,重点探讨应对不确定性的解鲁棒性与非预见性策略,通过Matlab代码实现SCI论文复现。研究涵盖多阶段鲁棒调度模型、机会约束规划、需求响应机制及储能系统优化配置,结合风电、光伏等可再生能源出力的不确定性建模,提出兼顾系统经济性与鲁棒性的优化运行方案。文中详细展示了模型构建、算法设计(如C&CG算法、大M法)及仿真验证全过程,适用于微电网能量管理、电力系统优化调度等领域的科研与工程实践。; 适合人群:具备一定电力系统、优化理论和Matlab编程基础的研究生、科研人员及从事微电网、能源管理相关工作的工程技术人员。; 使用场景及目标:①复现SCI级微电网鲁棒优化研究成果,掌握应对风光负荷不确定性的建模与求解方法;②深入理解两阶段鲁棒优化、分布鲁棒优化、机会约束规划等先进优化方法在能源系统中的实际应用;③为撰写高水平学术论文或开展相关课题研究提供代码参考和技术支持。; 阅读建议:建议读者结合文档提供的Matlab代码逐模块学习,重点关注不确定性建模、鲁棒优化模型构建与求解流程,并尝试在不同场景下调试与扩展代码,以深化对微电网优化运行机制的理解。

2,507

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧