
delphi生成的程序中表格取不到sql查询后的结果,请各位大神帮忙,代码如下 5
//更新列表procedureTForm1.refreshList();vars:string;begintrys:='selecta.request_idas请求ID,...
//更新列表
procedure TForm1.refreshList();
var
s: string;
begin
try
s := 'select a.request_id as 请求ID,b.trans_number as 交易号,' +
'b.customer_name as 客户名称,b.total_amount as 含税金额,' +
'a.o_machine_name as 原开票机,a.created_at as 创建时间' +
' from request_schedule a,pos b where a.machine_name=''%s'' and a.state=0 ' +
' and a.request_id = b.request_id ' +
' and a.priority = 0' +
' order by a.id desc limit 10 ';
s := Format(s, [l.ServerInfo.KPmachineID]);
l.mQ(dm.qryRequest, s);
self.dbgrdh1.Columns[0].Width := 215;
self.dbgrdh1.Columns[1].Width := 130;
self.dbgrdh1.Columns[2].Width := 180;
self.dbgrdh1.Columns[3].Width := 60;
self.dbgrdh1.Columns[4].Width := 80;
self.dbgrdh1.Columns[5].Width := 150;
except
on ex: exception do
begin
l.Writlogtxt('Err', 0, '取得请求队列失败。' + ex.Message);
dm.qryRequest.Close;
end;
end; 展开
procedure TForm1.refreshList();
var
s: string;
begin
try
s := 'select a.request_id as 请求ID,b.trans_number as 交易号,' +
'b.customer_name as 客户名称,b.total_amount as 含税金额,' +
'a.o_machine_name as 原开票机,a.created_at as 创建时间' +
' from request_schedule a,pos b where a.machine_name=''%s'' and a.state=0 ' +
' and a.request_id = b.request_id ' +
' and a.priority = 0' +
' order by a.id desc limit 10 ';
s := Format(s, [l.ServerInfo.KPmachineID]);
l.mQ(dm.qryRequest, s);
self.dbgrdh1.Columns[0].Width := 215;
self.dbgrdh1.Columns[1].Width := 130;
self.dbgrdh1.Columns[2].Width := 180;
self.dbgrdh1.Columns[3].Width := 60;
self.dbgrdh1.Columns[4].Width := 80;
self.dbgrdh1.Columns[5].Width := 150;
except
on ex: exception do
begin
l.Writlogtxt('Err', 0, '取得请求队列失败。' + ex.Message);
dm.qryRequest.Close;
end;
end; 展开
1个回答
展开全部
用两个AdoConnect和两个AdoQuery,分别连接ACCESS和SQL,然后循环ACCESS的query的方式,插入到SQL中
追问
我在dm里面有AdoQuery的名字叫qryRequest
这样 l.mQ(dm.qryRequest, s); 是不是就是说把s得到值放到了那个叫qryRequest的AdoQuery里面
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询