delphi 7+oracle,delphi 7 联接oracle9 源码

【实例简介】

delphi 7 联接oracle9 源码

【实例截图】

d7efab4a00b74b61d3276bba757a77e9.png

【核心代码】

procedure TForm1.Button1Click(Sender: TObject);

var

sqlstr: string;

sqlstr2: string;

i, j: Integer;

k: Integer;

begin

try

OraSession1.Options.Net := True;

OraSession1.Username := trim(user_Global);

OraSession1.Password := trim(password_Global);

OraSession1.Server := trim(server_Global);

OraSession1.Connect;

except

barMessage.Panels[1].Text := '       断开';

exit;

end;

barMessage.Panels[1].Text := '       正常';

{

DISTINCT train as 车次,id as 工号,name as 姓名,room as 房间,actin as 入寓时间,'

'actout as 出寓时间,seat as 床位,worksite as 地点 '

'

}

sqlstr := ' select  room,name from s_standbytime  where  nvl2(actout,0,1)=1   '

'    and  worksite = ' QuotedStr(caption_Global)

' and dat between to_date('

QuotedStr(DateToStr(Date() - 1)) ',' QuotedStr('yyyy-mm-dd') ') and to_date('

QuotedStr(DateToStr(Date())) ',' QuotedStr('yyyy-mm-dd') ') order by room,seat';

OraQuery1.sql.clear;

OraQuery1.sql.add(sqlstr);

OraQuery1.Active := True;

sqlstr2 := 'select DISTINCT room from S_room  where worksite= ' QuotedStr(caption_Global);

OraQuery2.sql.clear;

OraQuery2.sql.add(sqlstr2);

OraQuery2.Active := True;

if (h_int = 8) and (OraQuery2.RecordCount <> 8) then begin

h_int := OraQuery2.RecordCount div 5 1;

Timer_h.Enabled := True;

end;

for i := 0 to ComponentCount - 1 do

begin

if Components[i] is TStaticText then

if TStaticText(Components[i]).Caption = 'StaticText1' then

TStaticText(Components[i]).Caption := '';

if Components[i] is TLabel then

TLabel(Components[i]).Caption := '';

if Components[i] is TPanel then

if TPanel(Components[i]).Color <> clSkyBlue then

TPanel(Components[i]).Color := clLime;

end;

OraQuery2.First;

k := 1;

while not OraQuery2.Eof do begin

for i := 0 to ComponentCount - 1 do

begin

if Components[i] is TStaticText then

begin

if TStaticText(Components[i]).Parent.Tag = k then begin

if TStaticText(Components[i]).Caption = '' then begin

TStaticText(Components[i]).Caption := trim(OraQuery2.FieldList[0].AsString);

TStaticText(Components[i]).Tag := k;

TStaticText(Components[i]).Font.Color := clBlack;

TStaticText(Components[i]).Font.Style := [fsBold];

TStaticText(Components[i]).Font.Name := '隶书';

TStaticText(Components[i]).Font.Size := 42;

TStaticText(Components[i]).Alignment := taLeftJustify;

TStaticText(Components[i]).Left := 15;

TStaticText(Components[i]).top := 15;

TStaticText(Components[i]).AutoSize := True;

end;

end;

end;

if Components[i] is TLabel then

begin

if TLabel(Components[i]).Parent.Tag = k then begin

TLabel(Components[i]).Tag := k;

TLabel(Components[i]).Caption := '';

TLabel(Components[i]).Font.Color := clBlack;

TLabel(Components[i]).Font.Style := [];

TLabel(Components[i]).Font.Size := 18;

TLabel(Components[i]).Left := TStaticText(Components[i]).Parent.Width div 2;

TLabel(Components[i]).top := TStaticText(Components[i]).Parent.Height div 3;

TLabel(Components[i]).AutoSize := True;

end; end;

end;

k := k 1;

OraQuery2.Next;

end;

OraQuery1.First;

while not OraQuery1.Eof do begin

for i := 0 to ComponentCount - 1 do

begin

k := 0;

if Components[i] is TStaticText then begin

if TStaticText(Components[i]).Caption = trim(OraQuery1.FieldList[0].AsString) then begin

k := TStaticText(Components[i]).Tag;

end;

end;

for j := 0 to ComponentCount - 1 do

begin

if Components[j] is TLabel then

begin

if (TLabel(Components[j]).Tag = k) and (k > 0) then

if TLabel(Components[j]).Caption <> trim(OraQuery1.FieldList[1].AsString) then

if TLabel(Components[j]).Caption = '' then

TLabel(Components[j]).Caption := trim(OraQuery1.FieldList[1].AsString)

else

TLabel(Components[j]).Caption := TLabel(Components[j]).Caption #13 trim(OraQuery1.FieldList[1].AsString);

end;

if Components[j] is TPanel then

begin

if (TPanel(Components[j]).Tag = k) and (k > 0) then

TPanel(Components[j]).Color := clFuchsia;

end;

end;

end;

OraQuery1.Next;

end;

end;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值