delphi if then WITH DO 出错啊~~
procedureTForm4.btn1Click(Sender:TObject);varii:string;pp:Integer;beginifedt1.Enabled...
procedure TForm4.btn1Click(Sender: TObject);
var
ii:string;
pp:Integer;
begin
if edt1.Enabled=True then
ii:='id='''+edt1.text+'''';
with unit5.test.qry2 do
begin
Close;
SQL.Clear;
SQL.Add('select * from dbo.test where '+ii+'');
Open;
Unit5.test.lbl22.Caption:=fieldbyname('ID').asstring;
end
else
with unit5.test.qry1 do
begin
ii:='Indate between '''+datetostr(dtp1.Date)+'''and'''+Datetostr(dtp2.Date)+'''';
Close;
SQL.Clear;
SQL.Add('select * from dbo.inform where '+ii+'');
Open;
/////////
unit5.test.dbgrdh1.AutoFitColWidths:=True;
for pp:=0 to unit5.test.dbgrdh1.Columns.Count-1 do
with unit5.test.dbgrdh1.Columns[pp] do
OptimizeWidth; //自动排序
end;
[Hint] Unit4.pas(60): Variable 'pp' is declared but never used in 'TForm4.btn1Click'
[Error] Unit4.pas(73): 'END' expected but 'ELSE' found
[Error] Unit4.pas(74): ';' expected but 'WITH' found
[Error] Unit4.pas(76): Undeclared identifier: 'ii'
[Error] Unit4.pas(76): Undeclared identifier: 'dtp1'
[Error] Unit4.pas(83): '.' expected but 'FOR' found
[Warning] Unit4.pas(86): Text after final 'END.' - ignored by compiler
[Fatal Error] Unit4.pas(7): Could not compile used unit 'Unit4'
跪求~~~ 高手帮我! 展开
var
ii:string;
pp:Integer;
begin
if edt1.Enabled=True then
ii:='id='''+edt1.text+'''';
with unit5.test.qry2 do
begin
Close;
SQL.Clear;
SQL.Add('select * from dbo.test where '+ii+'');
Open;
Unit5.test.lbl22.Caption:=fieldbyname('ID').asstring;
end
else
with unit5.test.qry1 do
begin
ii:='Indate between '''+datetostr(dtp1.Date)+'''and'''+Datetostr(dtp2.Date)+'''';
Close;
SQL.Clear;
SQL.Add('select * from dbo.inform where '+ii+'');
Open;
/////////
unit5.test.dbgrdh1.AutoFitColWidths:=True;
for pp:=0 to unit5.test.dbgrdh1.Columns.Count-1 do
with unit5.test.dbgrdh1.Columns[pp] do
OptimizeWidth; //自动排序
end;
[Hint] Unit4.pas(60): Variable 'pp' is declared but never used in 'TForm4.btn1Click'
[Error] Unit4.pas(73): 'END' expected but 'ELSE' found
[Error] Unit4.pas(74): ';' expected but 'WITH' found
[Error] Unit4.pas(76): Undeclared identifier: 'ii'
[Error] Unit4.pas(76): Undeclared identifier: 'dtp1'
[Error] Unit4.pas(83): '.' expected but 'FOR' found
[Warning] Unit4.pas(86): Text after final 'END.' - ignored by compiler
[Fatal Error] Unit4.pas(7): Could not compile used unit 'Unit4'
跪求~~~ 高手帮我! 展开
2个回答
展开全部
procedure TForm1.Button1Click(Sender: TObject);
var
ii: string;
pp: Integer;
begin
if edt1.Enabled = True then
begin
ii:= 'id=''' + edt1.text + '''';
with unit5.test.qry2 do
begin
Close;
SQL.Clear;
SQL.Add('select * from dbo.test where '野汪 + ii + '');
Open;
unit5.test.lbl22.Caption:= fieldbyname('ID').asstring;
end;
end
else
begin
with unit5.test.qry1 do
旅明 begin
ii:= 颂镇仔'Indate between ''' + datetostr(dtp1.Date) + ''' and ''' + Datetostr(dtp2.Date) + '''';
Close;
SQL.Clear;
SQL.Add('select * from dbo.inform where ' + ii + '');
Open;
unit5.test.dbgrdh1.AutoFitColWidths:= True;
for pp:= 0 to unit5.test.dbgrdh1.Columns.Count - 1 do
with unit5.test.dbgrdh1.Columns[pp] do
OptimizeWidth; //自动排序
end;
end;
end;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
单片机,单片微型计算机。它是把中央处理器(CPU)、随机存取存储器(RAM)、只读存储器(ROM)、输入/输出端口(I/O)等主要计算机功能部件都集成在一块集成电路芯片上的微型计算机。单片机具有性能高、速度快、体积小、价格低、稳定可靠、应用...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询